tags:

views:

435

answers:

4

How to check an Ajax request in cakephp?

+4  A: 
  • You need to enable the RequestHandler component

var $components = array('RequestHandler');

  • Then you check if its an ajax request in your controllers with:

$this->ResquestHandler->isAjax()

You can find more information about the RequestHandler component here

pcp
+2  A: 

With RequestHandler::isAjax()?

deceze
A: 

Without the use of components you can use something like this:

$this->params['isAjax'];

This will return a bool.

gomflo
A: 

If you simply want to check the function of the php side, try:

$this->log('some debug',LOG_DEBUG);

then check app/tmp/logs/debug.log.

Leo