Ajax request not returning responseXML
|Reported by:||Nao||Owned by:||jaubourg|
Yesterday I found a bug in jQuery's behavior when doing a synchronous request to my server. (Yes, I know it's bad, but this is the only sync request in my entire, very large codebase, and can hardly be rewritten without adding too much unnecessary code, so I'd rather keep it this way.)
Whether you send a dataType (to xml) or not, it doesn't matter, having it set on auto or xml is the same. My server sends a proper string containing well-formed XML, and it is seen as text by jQuery, i.e. it returns a responseText but not responseXML object.
This bug can be reproduced in both jQuery 2.0 and jQuery 1.9.1, but not in jQuery 1.9.0.
I fixed it on my side by returning a text string without any tags (which had the added benefit of not wasting bandwidth and making my code shorter :)), but I'd rather not have this bug stay in the codebase, too afraid many sites will break and not understand why.
So I traced through the code, and I think the culprit is at line 8560 in jquery-git.js, or rather the missing lines of code that were in lines 8514 and 8516-8520 in jquery-1.9.0.js, which reference a bug fix for this unrelated report:
The report above was reopened last year, but I don't know why the fix was removed.
Here's an old jsfiddle snippet I found that reproduces this. Select jQuery 1.9.0, it works. Select jQuery (Edge) (i.e. 1.9.1pre) or jQuery 2.0.0b1, it doesn't work (responseXML is undefined).
Hopefully this is enough information to help you guys fix this without too much hassle.
Change History (20)
comment:1 Changed 4 years ago by jaubourg
- Component changed from unfiled to ajax
- Milestone changed from None to 1.9.2
- Owner set to jaubourg
- Priority changed from undecided to high
- Status changed from new to assigned
- Version changed from git to 1.9.1
comment:15 Changed 3 years ago by jaubourg
- Resolution set to fixed
- Status changed from assigned to closed