Ticket #5764 (closed bug: wontfix)
AJAX requests for XML documents fail if the Content-Type is incorrect
| Reported by: | bgreenlee | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.4 |
| Component: | ajax | Version: | 1.3.2 |
| Keywords: | ajax xml content-type | Cc: | |
| Blocking: | Blocked by: |
Description
If an XML document is sent with the wrong Content-Type (e.g. "text/html"), jQuery will return a parsererror, even if the response body is valid XML. This issue was discovered via a Rails bug in which cached content (in our case, an XML document) is returned with a Content-Type of "text/html" rather than the original Content-Type. See https://rails.lighthouseapp.com/projects/8994/tickets/1585-action-caching-sets-wrong-content-type-when-cache_path-is-a-string
I have a patch at http://github.com/bgreenlee/jquery/commit/47eaedf87385dd66421ef9126fddc2aaa0303148
Change History
comment:2 Changed 3 years ago by snover
- Status changed from new to closed
- Resolution set to wontfix
Thanks for the report, but this is not a jQuery bug. If the server is failing to provide the proper Content-Type header for XML data as required by the XMLHttpRequest spec, it is not jQuery’s responsibility to try to process the input anyway.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

Commit message updated to reference this ticket: http://github.com/bgreenlee/jquery/commit/88937d5d7aad72f32469841960e13d305c0d1d62