Confused by ajax xml parsing
I keep getting a parseerror using the basic AJAX function.
I know that the XML file I am sending is as follows:
<?xml version="1.0"?>
<response><Player><gameIndex>0</gameIndex>
<name>Billy</name>
<coins>25</coins>
<tickets>9</tickets>
<id>234234</id>
<guildId>4</guildId>
</Player>
<Player><gameIndex>1</gameIndex>
<name>Mitch</name>
<coins>0</coins>
<tickets>9</tickets>
<id>234235</id>
<guildId>4</guildId>
</Player></response>
This is, obviously, only an example.
What about this is throwing a parseerror?
-mdb
edit: Yeah, adding that now:
$.ajax({
type: "GET",
url: "response.php",
success: xmlParser,
datatype: xml,
error: xmlError,
ifModified: true
});
It actually worked CORRECTLY when I removed the "datatype" parameter, which is weird.
And, printing out the error in my function "xmlError"
function xmlError(request, textStatus, errorType)
{
$("#firstdiv").append(textStatus);
}
This adds the text "parseerror" to the page, with no more details. I also added some line breaks to my XML for readability. I see no reason that the above XML should not parse correctly - is it possible that jquery's parser enforces no leading or trailing whitespace? If so, I'd call that a bug.