title: Cakephp 2.x and Jquery Ajax - Cake doesn't think request is ajax
body: <p>I am working on a little cakePHP application and am trying to AJAX it up a bit with JQuery to make it work a bit nicer for users.</p>
  
  <p>I have just followed this tutorial: <a href="http://www.jamesfairhurst.co.uk/posts/view/ajax_delete_with_cakephp_and_jquery" rel="nofollow">Cakephp Jquery AJAX Tutorial</a> but for some reason it isn't working.</p>
  
  <p>One great bit about the tutorial is that functionality falls back to normal CakePHP if the request isn't an AJAX request so my app still works but it doesn't work the AJAX way...</p>
  
  <p>It looks like in my Controller, the request doesn't pass the test:</p>
  
  <pre><code>if($this-&gt;request-&gt;is('ajax'))
  </code></pre>
  
  <p>and so continues onto the normal <code>$this-&gt;redirect(...)</code> of the non-AJAX way.</p>
  
  <p>Could it be something to do with the if statement for 'ajax'? In the tutorial the author is using a version of cakePHP before 2.0 and so uses <code>$this-&gt;RequestHandler-&gt;isAjax()</code> but this was deprecated as of cakePHP 2.0.</p>
  
  <p>Thanks for your time.</p>