title: Autocomplete implementation in cakephp 2.4
body: <p>Hello Guys i am very new to cakephp and i want to implement autocomplete in my project. I have downloaded two javascript file jquery.autocomplete.js and jquery.autocomplete.min.js and placed them both in my webroot directory. i have a field named city in my database which i have to autocomplete.  the problem is my sutocomple is not firing or even not showing alert when key is pressed.</p>
  
  <p>my javascript code is </p>
  
  <pre><code> &lt;script src="../../webroot/js/jquery.autocomplete.js" 
    type="text/javascript"&gt;&lt;/script&gt;
   &lt;script src="../../webroot/js/jquery.autocomplete.min.js" 
   type="text/javascript"&gt;&lt;/script&gt;
   $(function() {
   $('#Usercity').autocomplete({
       alert("ashish");
  
      //dataType: "json"
      minLength: 1,
      source: function( request, response ) {
          $.ajax({
              url: "/User/autoComplete",
              dataType: "jsonp",
              data: {
                  featureClass: "P",
                  style: "full",
                  maxRows: 12,
                  term: request.term
              },
              success: function( data ) {
                  response( $.map( data, function( el ) {
                      return { label: el.id, value: el.city }
                  }));
              }
          });
      }
  
     });
  
      });
    &lt;/script&gt;
             echo $this-&gt;Form-
     &gt;input('city',array('type'=&gt;'text','label'=&gt;'City'));
  
  
     Controller code
  
  
         public function autoComplete() {
      Configure::write('debug', 0);
      $this-&gt;layout = 'ajax';
      $query = $_GET['term'];
      $items = $this-&gt;User-&gt;find('all', array(
          'conditions' =&gt; array('User.city LIKE' =&gt; $query . '%'),
          'fields' =&gt; array('city')));
  
      foreach ($items as $item) {
          $data[] = $item['Item'];
      }
      $data = json_encode($data);
      echo $data;
      exit;
  }
  </code></pre>
  
  <p>}</p>