I am developing an application in Kohana framework. I would like to know the best practices in implementing ajax in kohana. So far I am using different controller for ajax. I think the important concerns will be minimizing the resources requirement and handling sessions.
Thanks in advance
I'm using this:
In Controller_Template:
public function before()
{
$this->auto_render = ! $this->request->is_ajax();
if($this->auto_render === TRUE)
{
parent::before();
}
}
And inside my actions:
if ($this->request->is_ajax())
{
...
$this->response->headers('Content-type','application/json; charset='.Kohana::$charset);
$this->response->body($jsonEncoded);
}