title: return response correctly for jquery autocomplete in Codeigniter
body: <p>I am new to jquery and am having trouble with the autocomplete function. edit:I should mention I am using MVC with Codeigniter. My AJAX response is returning like this <code>[{"customer_name":"Adecco Management &amp; Consulting S.A."}]</code>. It is also not all in a row it is each character in the dropdown like this</p>
  
  <pre><code>[
  {
  "
  c
  u
  s
  t
  </code></pre>
  
  <p>and so on. Here is my autocomplete script.</p>
  
  <pre><code>$('#cust_name').autocomplete({
      source: function(request,response){
          var request = {
              toSearch: $('#cust_name').val()
          };
          $.ajax({
              url: '/researchDB/index.php/rdb_con/autoComplete',
              data: request,
              datatype:"json",
              type: 'POST',
              success: function(data){
                  response(data);
              }
          });
      }
  });
  </code></pre>
  
  <p>and my controller:</p>
  
  <pre><code>function autoComplete(){
      $data['id'] = $this-&gt;rdb_mod-&gt;autoComplete();
      echo json_encode($data['id']);
  }
  </code></pre>
  
  <p>model:</p>
  
  <pre><code>public function autoComplete(){
          $toSearch = $_POST['toSearch'];
          $this-&gt;db-&gt;select('customer_name');
          $this-&gt;db-&gt;like('customer_name', $toSearch,  'after');
          $query = $this-&gt;db-&gt;get('research');
          return $query-&gt;result();
      }
  </code></pre>
  
  <p>input in view:</p>
  
  <pre><code>&lt;input data-input-type="cust_name" id="cust_name" class="ids form-control search-query " type="text"  name="customer_name"&gt;
  </code></pre>
  
  <p>I am not sure I set up the jquery function correctly but the response includes the desired results, in the wrong format, when I type in the input. Thanks for any help you can give!</p>