title: parsererror / SyntaxError: Unexpected token <
body: <p>I've searched a lot for this but the answers that I find doesn't work but I think that the problem is mine. </p>
  
  <p>JavaScript:</p>
  
  <pre><code>$.ajax({
      type: 'POST',
      url: url,
      data: data,
      dataType: 'json',
      success: function(response) {
          if(response.status == true) {
              alert('ok');
          } else {
              alert('error');
          }
      },
      error: function(xhr, desc, err) {
          console.log(xhr);
          console.log("Details: " + desc + "\nError:" + err);
      }
  });
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>if(User::addFavLater($id, $user, 'favs')) {
      $result = array("status" =&gt; true);
  } else {
      $result = array("status" =&gt; false);
  }
  
  header('Content-type: application/json');
  echo json_encode($result);
  </code></pre>
  
  <p>So, this is an excerpt of code that I have and I think can you realising. I want PHP to send a JSON response into JavaScript but this is not happening and JavaScript gives me this error:</p>
  
  <pre><code>parsererror / SyntaxError: Unexpected token &lt;
  </code></pre>
  
  <p>I'm using the 2.1.1 version of JQuery.</p>
  
  <p>P.S.: Sorry for my english.</p>