On the view, there is this basic javascript/jquery:
$('#jsoncallbtn').click(function() {
$.post('/mycontroller/json', {
someint: 123,
somestr: 'string'
}, function(datafromserver) {
alert(datafromserver.data1); // prints "test"
alert(datafromserver.data2); // prints "null"
}, "json");
});
On server side:
public function jsonAction()
{
$jsonArray = array('data1' => 'test',
'data2' => $this->render('anotheraction'));
$this->_helper->json($jsonArray);
}
Is there a way to render another action view and send it back for javascript as part of json object?