if ($this->getRequest()->isXmlHttpRequest()) {
$this->_helper->layout->disableLayout();
$ajaxContext = $this->_helper->getHelper('AjaxContext');
$ajaxContext->addActionContext('view', 'html');
$ajaxContext->initContext();
}
how does this actually work… my ajax get page is local.maker/profile/check
i got ajax to work fine but i dont know what to edit from the above…
$ajaxContext->addActionContext('???', 'html');
ps.. i am requesting a json
I use the following code to use AJAX context helper.
In your controller create a preDispatch method to set up your contexts like this:
And then in you action methods use:
Also in your ajax request you must use the variable format to set the current context, for example
to request a json response.
Note: The context switcher automatically disables the layout and view, any view variable set in the controller will automatically be encoded into a json string and sent.
I hope this helps
Kind regards
Garry