title: CodeIgniter + jQuery UI autocomplete = 500 internal server error (with code) due to CSRF set to TRUE
body: <p>Here is the view code:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
          &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"&gt;&lt;/script&gt;
  
          &lt;!-- Load JQuery UI --&gt;
          &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $( function() {    
  
          $("#input").autocomplete({
              source: function(req, add){
                  $.ajax({
                      url: '&lt;?php echo base_url(); ?&gt;test/ac2',
                      dataType: 'json',
                      type: 'POST',
                      //data: req,
                      data: 'input='+req,
                      success: function(data){
                          if(data.response =='true'){
                             add(data.message);
                          }
                      }
                  });
          },
          minLength: 2,
          select: function(event, ui){
              $(this).end().val(ui.item.value);
              }
          });
  
       });      
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;?php
  
  echo form_open();
  echo form_input('input', '', 'id="input"');
  echo form_close();
  
  ?&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and the controller code:</p>
  
  <pre><code>class Test extends CI_Controller {
  
      function index()
      {
          $this-&gt;load-&gt;view('vw/test_vw');
      }
  
      public function ac2()
      {
  
          //$search = $this-&gt;input-&gt;post('term');
                $search = $this-&gt;input-&gt;post('input');
  
          $data['response'] = 'false';
  
          $this-&gt;db-&gt;select('*');
          $this-&gt;db-&gt;from('loc_exercise');
          $this-&gt;db-&gt;like('locations', $search);
          $locations = $this-&gt;db-&gt;get()-&gt;result();
  
  
          if (count($locations) &gt; 0) {
              $data['message'] = array();
  
              foreach ($locations as $location) {
                  $data['message'][] = array(  'label' =&gt; $location-&gt;locations,
                  'item'  =&gt; $location-&gt;locations,
                  'value' =&gt; $location-&gt;locations );
              }
  
              $data['response'] = 'true';
          }
          echo json_encode($data);
      }
  </code></pre>
  
  <p>When I type anything in into the input box I get this on the console:</p>
  
  <pre><code>POST http://my.example.com/test/ac2 500 (Internal Server Error)
  </code></pre>
  
  <p>and on CI error logs there seems to be no issues (log_threshold is 1, /logs is chmod 777).</p>
  
  <p>BTW I have my config.php with query_strings TRUE and allow_get_array TRUE.</p>
  
  <p>Any ideas how to fix this issue?</p>