title: AJAX jQuery success with IE8, fails with IE10/Chrome/FF
body: <p>I am facing a very odd issue with jQuery and AJAX. My AJAX call goes to <code>success</code> with IE8 but into <code>error</code> with IE10, Chrome and Firefox.</p>
  
  <p>Here is the PHP code in Zend Framework 2:</p>
  
  <pre><code>$response = $this-&gt;getResponse();
  $headers = $response-&gt;getHeaders();
  $headers-&gt;clearHeaders()
          -&gt;addHeaderLine('Content-Type', 'application/json; charset=utf-8');
  $response-&gt;setContent(json_encode($array));
  return $response;
  </code></pre>
  
  <p>Where <code>$array</code> is a PHP array. </p>
  
  <p>Here is my Javascript code:</p>
  
  <pre><code>$.ajax({
      url: "/application/getTypeDossierParPilote/" + idPilote,
      type: "POST",
      async : false,
      success: function(data) {
          LISTE_TYPE_BANDEAU = data;
          ID_PILOTE_SELECTED_BANDEAU = idPilote;
          LISTE_TYPE_BANDEAU_LOADED_BANDEAU = true;                    
      },
      error: function errorHandler(e)             
          ID_PILOTE_SELECTED_BANDEAU = 0;
          LISTE_TYPE_BANDEAU_LOADED_BANDEAU = false;
          LISTE_TYPE_BANDEAU = null;                      
      }                
  });
  </code></pre>
  
  <p>When using IE8, it goes to <code>success</code> and the data are usable. When using IE10, it goes to <code>error</code>. Although, when my client tries this on IE10, he doesn't get any issue, so I assume it goes straight to <code>success</code>.</p>
  
  <p>I have tried adding something like <code>dataType: "json",</code> and even <code>dataType: "html",</code> to check whether the JSON is correct or not and it goes to <code>success</code> in that latter case but the data are not usable. </p>
  
  <p>When I use the developer mode of the browser to copy the response body and check on <a href="http://jsonlint.com/" rel="nofollow">http://jsonlint.com/</a> whether the JSON is correct or not I get the following message :</p>
  
  <blockquote>
    <p>JSON.parse: unexpected character at line 1 column 1 of the JSON data</p>
  </blockquote>
  
  <p>where the first character is the curly bracket. Here is an example of a JSON that I get :</p>
  
  <pre><code>{
      "typeDossier": [
          {
              "type": "MED",
              "famille": "AEC",
              "codeType": 1,
              "session": ""
          },
          {
              "type": "HPS",
              "famille": "AEC",
              "codeType": 2,
              "session": ""
          }
      ],
      "aecHps": true,
      "CodeAecHps": "1,2,",
      "tous": "1,2,"
  }
  </code></pre>
  
  <p>Hope you can help me out with this weird issue. Thank you in advance.
  Regards,</p>