The Ajax plugin allows you to call your actions using a javascript's XmlHttpRequest and sending back json or the view without the layout.
For the plugin to be activated, the request must have the “X-Requested-With” HTTP header. Nearly all javascript frameworks add this header.
When this header is detected, the layout will be automatically disabled. This can be avoided by setting the “disable_layout” configuration key to false.
The default behaviour when activated is to return the action variables as a json encoded array. So the view won't be rendered. It is possible to disable this behaviour and render the view (the layout is still disable) by adding action names in the “restricted” configuratio key.
Example 1.1. Render views instead of returning variables
Atomik::set('plugins/Ajax', array(
'restricted' => array(
'my-partial'
);
));
The opposite behaviour can also be acheived when setting false to the “allow_all” configuration key. In this case, all views will be rendered and the variables will never be returned. It is then possible to enable variables output on some actions only using the “allowed” configuration key.