title: How can I return a valid Json object from a PHP file to a jQuery file
body: <p>I made the simplest senario possible to make sure I didn't make a stupid mistake</p>
  
  <p><strong>The HTML/JS file</strong> (using jQuery 1.6.x but I also tried it on jsfiddle with 1.9.x</p>
  
  <pre><code>$.ajax({
      dataType: "jsonp",
      url: 'http://example.com/api/test.php',
      success: function(data){
          //Never reached
          alert('Success');
          console.log(data);
      }
  });
  </code></pre>
  
  <p><strong>test.php</strong> - PHP 5.3.x</p>
  
  <pre><code>&lt;?php
  header("Content-Type: application/json; charset=utf-8", true);
  echo json_encode(array("test" =&gt; "test"));
  ?&gt;
  </code></pre>
  
  <p><strong>Error returned</strong></p>
  
  <pre><code>Uncaught SyntaxError: Unexpected token : 
  </code></pre>
  
  <p>I've messed with the php file's header and some parameters in the ajax call. Nothing worked. I'm really confused as to why this simple scenario does not work. The problem is on the PHP side because changing the url to a different source (<a href="http://echo.jsontest.com/test/test" rel="nofollow">http://echo.jsontest.com/test/test</a> for example) works. I have a feeling it's a PHP config but I dont know where to look.</p>