title: POST url 403 forbidden in Codeigniter 3
body: <p>Hi experts can you give me a suggestion, why I am getting this 403 forbidden on my code igniter currently running on my localhost.</p>
  
  <p><a href="http://i.stack.imgur.com/XXlbQ.png" rel="nofollow">403 forbidden</a></p>
  
  <hr>
  
  <p>The process is like this:</p>
  
  <ul>
  <li><p>I am using ajax for easy and smoothly access and retrieving of data from model, controller to the view the image below is my code in my views to controller.</p>
  
  <pre><code>&lt;div class="modal-header s-example-modal-sm" aria-labelledby="mySmallModalLabel"&gt;
  </code></pre>
  
  <p>&times;
    New Question Modal
          
    
    
      function question_save(){</p>
  
  <pre><code>  $.ajax({
          url : "&lt;?php echo base_url('Mainx/insert_question_header');?&gt;",
          crossDomain: true,
          contentType: "application/x-www-form-urlencoded",
          method: "POST",
          data: { name: 'question_header'},
          dataType: 'json',
          '&lt;?php echo $this-&gt;security-&gt;get_csrf_token_name(); ?&gt;' : '&lt;?php echo $this-&gt;security-&gt;get_csrf_hash(); ?&gt;',
  
          success: function(data){
              //alert('data save');
          },
          error: function (jqXHR, textStatus, errorThrown){
              alert('Error adding');
          }
      });
  }  
  </code></pre>
  
  <p>
    </p>
  
         
  
  <p>
        Question Header: 
        
    </p>
  
    
  
  <p>      
    
        </p></li>
  </ul>
  
  <hr>
  
  <p>And lastly from my controller and display the value that i type in my input under my view. </p>
  
  <pre><code>public function insert_question_header(){
      $insert_header = array(
  
          'question_header'=&gt; $this-&gt;input-&gt;post("question_header")
  
      );
      //$this-&gt;db-&gt;insert('tb_question_header', $insert_header);
      echo json_encode($insert_header);
      redirect('Mainx/question_form/success' ); 
  }
  </code></pre>