I just want to ask if it is possible to re-render the same view through dojo xhrpost?
On my /app/index.phtml page I have a button that will fire an action through dojo xhrpost which will call the same /app action controller.
It successfully calls the controller but the page is not renderi开发者_运维百科ng with the updated data.
Here's the ajax call part
var xhrArgs = {
url: "/app",
handleAs: "text",
load: function(data) {
console.log(data);
},
error: function(error) {
console.log(error);
}
}
dojo.xhrPost(xhrArgs);
Controller
public function indexAction()
{
$apps = new Application_Model_Application();
if($this->_request->isPost()){
$this->view->apps = $apps->getAppsById("2");
}else{
$this->view->apps = $apps->getAllApps();
}
$this->render();
}
I'm getting the response on firebug which gives me the rendered page but the actual view itself is not re-loaded with the new apps data ($this->view->apps)
Am I missing something? Please help.
You'll need to use Dojo to render the new retrieved data into the DOM of your page. The controller will return it into the variable, but won't display it.
Hope that helps,
精彩评论