How to check an Ajax request:
I am writing this blog specially for beginners who are learning Cakephp. In order to check whether the request is through Ajax or not. This can be checked by enabling the RequestHandler
component in AppController or enable this on the Controller where you are using it. Type this code to enable RequestHandler:
var $components = array('RequestHandler');
If its Cakephp 1.3.x, then you check if its an ajax request in your controllers with:
$this->RequestHandler->isAjax()
and in Cakephp 2.x:
$this->request->is('ajax');
Thats all!
Thanks for reading the blog.
0 Comment(s)