title: Ajax error 403 Forbidden CodeIgniter
body: <p>I have two links on my html page :</p>
  
  <pre><code>&lt;a id="1" onclick="like(this.id)"&gt;first&lt;/a&gt;
  &lt;a id="2" onclick="like(this.id)"&gt;Second&lt;/a&gt;
  </code></pre>
  
  <p>My JS is the following :</p>
  
  <pre><code>function like (id) {
      $.ajax({
          type:'POST',
          data: {
              func:
                  'getNewLocations',
              '&lt;?php echo $this-&gt;security-&gt;get_csrf_token_name(); ?&gt;':
                  '&lt;?php echo $this-&gt;security-&gt;get_csrf_hash(); ?&gt;',
              message:id
          },
          url:'&lt;?php echo base_url();?&gt;index.php/Category/like',
          success: function(result, statut) {
              if (result == 'add') {
                  //do something
              }
              else if (result == 'remove') {
                  //do something
              }
          }
      });
  }
  </code></pre>
  
  <p>And the php method is the following (just for the example):</p>
  
  <pre><code>public function like() {
      echo 'add';
  }
  </code></pre>
  
  <p>When I click at first on the link 1, the ajax request works fine, the server answers 'add'. But when I click on the link 2, I have a 403 error. Even more surprising, when I click at fisrt on the link 2, it works but then the link 1 doesn't.
  I work with codeIgniter.</p>
  
  <p>Any idea of why and how solve it ?
  Thanks</p>