title: Parsing XML from php using jquery
body: <p>I have a script in php that writes XML.</p>
  
  <p>I use an ajax call to read that XML.</p>
  
  <pre><code>$.ajax({
          url: "http://blablabla.com/myscript.php",
          data: requestVars,
          dataType: 'xml',
          success: function(xml){
              XMLParser(xml);
              },
          error: function(xhr,err){
              alert("readyState: "+ xhr.readyState + "\nstatus: " + xhr.status + "\nerror:" + err);
              alert("responseText: " + xhr.responseText);
              }
      });
  </code></pre>
  
  <p>On php I have this:</p>
  
  <pre><code>&lt;?php
  header('Content-Type: application/xml; charset=UTF-8');
  
  ...
  ?&gt;
  </code></pre>
  
  <p>(tried both with application/xml and text/xml)</p>
  
  <p>Problem:</p>
  
  <p>Works like a charm in Google Chrome, fails on IE9 and Firefox with readyState: 4, status: 200 and Error: parsererror</p>
  
  <p>EDIT:
  A little piece of sample XML:</p>
  
  <pre><code>&lt;?xml version='1.0' encoding='utf-8'?&gt;
  
      &lt;Index Title="asdsad" isImg="0"&gt;
        &lt;Categories&gt;
          &lt;Cat Id="13"&gt;
            &lt;Title&gt;Movies&lt;/Title&gt;
          &lt;/Cat&gt;
          &lt;Cat Id="15"&gt;
            &lt;Title&gt;Books&lt;/Title&gt;
          &lt;/Cat&gt;
        &lt;/Categories&gt;
        &lt;Subject Id="141" Open="0"&gt;
          &lt;Title&gt;Subject A&lt;/Title&gt;
          &lt;Resource Id="553" Level="2"&gt;
            &lt;Title&gt;Resource A1&lt;/Title&gt;
          &lt;/Resource&gt;
          &lt;/Subject&gt;
      &lt;/Index&gt;
  </code></pre>