は、この基本的なJavaScriptの/ jqueryのがあります:php/zend/json:ビューをフェッチしてjsonオブジェクトとして渡す方法は?ビューで
サーバー側で$('#jsoncallbtn').click(function() {
$.post('/mycontroller/json', {
someint: 123,
somestr: 'string'
}, function(datafromserver) {
alert(datafromserver.data1); // prints "test"
alert(datafromserver.data2); // prints "null"
}, "json");
});
:
public function jsonAction()
{
$jsonArray = array('data1' => 'test',
'data2' => $this->render('anotheraction'));
$this->_helper->json($jsonArray);
}
は別のアクションのビューをレンダリングしての一環としてのjavascriptのためにそれを送り返すする方法はありますjsonオブジェクト?
それは仕事をすることができますが、よりよい方法もあります。 – Phil
ありがとうございました!私はこれを探しています:D – evilReiko
喜んで助けました。乾杯。 –