ビューで、Student という変数を定義します。私の見解では、Student オブジェクトを JSON として表示するにはどうすればよいですか?
public function previewAction()
{
// ...
$this->view->student = $student;
}
私の preview.phtml ビューには、次のものがあります。
<script>
// this doesn't return the Application_Model as a JSON object in the html
var studentData = <?php echo Zend_Json::encode($this->student); ?>;
</script>