title: Ajax request in cakephp 2.x
body: <p>I'm trying to send a simple ajax request in cakephp. I've to send ajax requests for many buttons. But I'm just trying a simple ajax request first. But it's not working for some reason. This is what I've done so far. This is my code.</p>
  
  <p><strong>show.ctp</strong></p>
  
  <pre><code>&lt;?php echo $this-&gt;Html-&gt;script('jquery', FALSE); ?&gt;
  
  &lt;?php
  
  echo $this-&gt;Form-&gt;create();
  echo $this-&gt;Form-&gt;input('field', array('id'=&gt;'field'));
  echo $this-&gt;Js-&gt;submit('Send', array(
  'before'=&gt;$this-&gt;Js-&gt;get('#sending')-&gt;effect('fadeIn'),
  'success'=&gt;$this-&gt;Js-&gt;get('#sending')-&gt;effect('fadeOut'),
  'update'=&gt;'#success'
  ));
  
  ?&gt;
  
  &lt;div id='sending' style="display:none"&gt; Counz[dot]gif will be displayed &lt;/div&gt;
  &lt;div id='success'&gt;&lt;/div&gt;
  </code></pre>
  
  <p><strong>controller</strong></p>
  
  <pre><code>var $name = 'count';
  
      public $helpers = array('Js' =&gt; array('Jquery'));
      //var $helpers = array('Ajax', 'Javascript');
      var $components = array('RequestHandler');
  
  public function show(){
          if($this-&gt;RequestHandler-&gt;isAjax()){
              $this-&gt;render('success', 'ajax'); //ajax tells the layout it should use
  
          }else{
              $this-&gt;set('for_map', $this-&gt;count-&gt;find('all'));
  
          }
      }
  </code></pre>
  
  <p><strong>success.ctp</strong></p>
  
  <pre><code>&lt;p&gt;It's working&lt;/p&gt;
  </code></pre>
  
  <p>Also ajax.ctp is there by default.</p>
  
  <p>Please tell me what am I doing wrong. Thanks. :)</p>