title: Codeigniter ajax request 500 internal server error
body: <pre><code>&lt;script type="text/javascript"&gt;
      $(window).load(function(){
           $(".button_next a ").click(function(){
               var cct = $("input[name=syncrypts]").val();
  
               $.ajax({
                   url:"&lt;?php echo base_url(); ?&gt;index.php?customer/product/import", //Server script to process data
                   type: "POST",
                   data: { 'csrf_token_name': cct },
                   error: function (err) {
                       console.log("AJAX error in request: " + JSON.stringify(err, null, 2));
                   },
                   success: function(response){
                        alert("ok");     
                    }
               });
           });
      });
  &lt;/script&gt;
  
  &lt;?php echo form_open(base_url() . 'index.php?customer/product/import', array(
                  'enctype' =&gt; 'multipart/form-data', 
                  'class' =&gt; 'uk-form-stacked',
              ));
  
      ?&gt;
              &lt;input type="hidden" name="&lt;?php echo $this-&gt;security-&gt;get_csrf_token_name(); ?&gt;" value="&lt;?php echo $this-&gt;security-&gt;get_csrf_hash(); ?&gt;"&gt;
  &lt;?php echo form_close() ?&gt;
  </code></pre>
  
  <p>The code not work. I have equally 500 internal server error. Why? I enabled csrf in the config.php. The post that i read is this <a href="http://aymsystems.com/ajax-csrf-protection-codeigniter-20" rel="nofollow">http://aymsystems.com/ajax-csrf-protection-codeigniter-20</a></p>