title: Jquery Ajax Autocomplete with codeigniter 'term' issues
body: <p>My ajax <strong>autocomplete does return the countries from the server but</strong> it does always show <strong>all</strong> countries <strong>whatever I type</strong>. There is something wrong with sending the request.term to controller to Model but I can't figure out what it is. Thanks very much for any hint!</p>
  
  <p>html:</p>
  
  <pre><code>&lt;input type='text' name='location_search' id='location_search' placeholder='Type Location' &gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>$(function(){
      var $sfield = $('#location_search').autocomplete({
          source: function(request, response){
              var url = "&lt;?php echo site_url('autocomplete/control_areas'); ?&gt;";
                $.post(url, {data:request.term}, function(data){
                  response($.map(data, function(countries) {
                      return {
                          value: countries.name_en
                      };
                  }));
                }, "json");  
          },
          minLength: 2,
          autofocus: true
      });
  });
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>function control_areas(){
      $this-&gt;load-&gt;model('autocomplete_model');
      $term = $this-&gt;input-&gt;get('term', TRUE);
      $countries = $this-&gt;autocomplete_model-&gt;get_areas($term);
      echo json_encode($countries);
  }
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>function get_areas($term){
      $this-&gt;db-&gt;where('name_en', $term);
      $query = $this-&gt;db-&gt;get('countries');
      return $query-&gt;result(); 
  }
  </code></pre>