/ Published in: PHP

Example controller used for AJAX requests - Disables layout, shows how to sent an action to not render a view (setNoRender) and adds some security checks.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php /****************************************** App Async Controller for AJAX functionality Module: App Controller: Async ******************************************/ class App_AsyncController extends Zend_Controller_Action { public function init() { //Set no views to render in any action //You may wish to change this if you want to use a view file $this->getHelper('viewRenderer')->setNoRender(); //Ensure this is an AJAX request if(!$this->_request->isXmlHttpRequest()) { } } public function someAction() { //Disable the layout. $this->getHelper('layout')->disableLayout(); } }
Comments
