Ticket #8416 (closed bug: worksforme)
IE9 jqXHR.responseXML returns "undefined"
| Reported by: | anonymous | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | ajax | Version: | 1.5.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Using jqXHR.responseXML method in IE9RC returns "undefined"
while FireFox 3.6.13 correctly returns: [object XMLDocument]
A simple .XML which is read locally:
<?xml version="1.0" encoding="utf-8"?>
<hello>
<world>earth</world>
</hello>
Read by:
$.ajax({
url: "hello.xml",
dataType: "xml",
complete: function(jqXHR) {
alert("jqXHR.responseText = " + jqXHR.responseText);
alert("jqXHR.responseXML = " + jqXHR.responseXML);
}
});
Change History
comment:2 Changed 2 years ago by jaubourg
http://jsfiddle.net/jaubourg/kxQLg/
The xml is undefined because it is null on the native xhr. Could you provide a proper test-case?
comment:3 Changed 2 years ago by Yomodo
Hi,
I need to load a local .xml file, this can be done in FireFox but not in the IE's (also IE8).
In IE I now have to use .responseText first, followed by .loadXML() to creating an [object XMLDocument].
Yomodo
comment:4 Changed 2 years ago by jaubourg
You do realize the xml is most probably already parsed and passed as the first parameter of the success callback, right?
comment:5 Changed 2 years ago by anonymous
Most probably? Both the .success() and .complete() method return "undefined" in IE 8 and 9.
It just doesn't make any sense, both the xml and jQuery are valid. Still in IE the result is not an XML object. I really can't understand why, unless this is a bug in IE.
Yomodo
comment:6 Changed 2 years ago by jaubourg
- Status changed from new to closed
- Resolution set to worksforme
- Component changed from unfiled to ajax
OK, I tested this on my local webserver using IE9 and it worked flawlessly.
comment:7 Changed 2 years ago by Yomodo
Hi,
Could you please elaborate "what" worked flawlessly?
I guess you did not receive a "undefined" but an "[object XMLDocument]" in Internet Explorer 9?
Regards, Yomodo
comment:8 follow-up: ↓ 9 Changed 2 years ago by dmethvin
This test case works for me in IE8, does it work in IE9? I don't have it handy right now.
Does the problem only happen for locally loaded XML files?
comment:9 in reply to: ↑ 8 ; follow-up: ↓ 10 Changed 2 years ago by Yomodo
Replying to dmethvin:
This test case works for me in IE8, does it work in IE9? I don't have it handy right now.
Does the problem only happen for locally loaded XML files?
Hi, I'm so sorry. Just saw your reply.
YES, your fiddle examples also works in IE9! I'm using this for .HTA's, so yes it would be locally loaded XML files.
Yomodo
comment:10 in reply to: ↑ 9 Changed 2 years ago by Yomodo
Hmm.. If I copy/paste the example and actually load a real xml file, locally the .responseXML is still "undefined"
comment:11 Changed 2 years ago by anonymous
Please also see this ticket: http://bugs.jquery.com/ticket/8571
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

jsFiddle test case: http://jsfiddle.net/n3vXu/
Kind regards, Yomodo