I have a script in php that writes XML.
I use an ajax call to read that XML.
$.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);
}
});
On php I have this:
<?php
header('Content-Type: application/xml; charset=UTF-8');
...
?>
(tried both with application/xml and text/xml)
Problem:
Works like a charm in Google Chrome, fails on IE9 and Firefox with readyState: 4, status: 200 and Error: parsererror
EDIT: A little piece of sample XML:
<?xml version='1.0' encoding='utf-8'?>
<Index Title="asdsad" isImg="0">
<Categories>
<Cat Id="13">
<Title>Movies</Title>
</Cat>
<Cat Id="15">
<Title>Books</Title>
</Cat>
</Categories>
<Subject Id="141" Open="0">
<Title>Subject A</Title>
<Resource Id="553" Level="2">
<Title>Resource A1</Title>
</Resource>
</Subject>
</Index>