[eluser]Pascal Kriete[/eluser]
I assume you mean view, not controller. Your javascript should not be in the controller (the backend obviously will be though).
I've never used projax, but generally to update multiple items you need to do something like this (only works in php5):
PHP Backend:
Code:
$return['first'] = 'First div stuff';
$return['second'] = 'For the second div';
echo json_encode($return);
Javascript (using prototype):
Code:
new Ajax.Request(url, {
method: 'post',
onComplete: function(dumptruck) {
var json = dumptruck.responseText.evalJSON(true);
$('firstdiv').update(json.first);
$('seconddiv').update(json.second);
}
});
So basically: You echo a json object - eval it (carefull there are security risks) - and then treat it like any old object