Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 10 years ago

#10527 closed bug (fixed)

AJAX deferred should call success on "No Content," even when a Content-Type is specified

Reported by: [email protected] Owned by: [email protected]
Priority: low Milestone: None
Component: ajax Version: 1.6
Keywords: needsreview Cc: jaubourg
Blocked by: Blocking:


When a Content-Type such as "text/xml" is specified in an HTTP 204 ("No Content") status, jquery finds a converter for the datastream in the ajaxConvert() function. This ends up calling parseXML, which creates an invalid XML document and jquery throws an error.

In a 204 No Content situation, jquery should not attempt to parse the empty document. Or, parseXML should return an empty document when passed an empty string.

Change History (9)

comment:1 Changed 11 years ago by addyosmani

Cc: jaubourg added
Component: unfiledajax
Priority: undecidedlow

comment:2 Changed 11 years ago by timmywil

Owner: set to [email protected]
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a reduced test case to help us assess your ticket.

Additionally, be sure to test against the git version to ensure the issue still exists.

comment:3 Changed 11 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:4 Changed 11 years ago by dmethvin

Resolution: invalid
Status: closedreopened

comment:5 Changed 11 years ago by timmywil

Keywords: needsreview added
Status: reopenedopen

comment:6 Changed 11 years ago by jaubourg

Resolution: fixed
Status: openclosed

Makes parseXML act like parseJSON when given an empty or non-string input: now returns null rather than throwing an exception. Incidently fixes #10527. Unit tests added.

Changeset: d30859eb6bd5af9aafa9db003e17835ff594d019

comment:7 Changed 11 years ago by [email protected]

It looks like this has been fixed in 1.7.2. For anyone trying to work around this in a previous version, I found that forcing the datatype to 'text' in an ajax query works.

comment:8 Changed 10 years ago by anonymous

This is still broken in 1.7.2 when using 'jsonp' dataType.

comment:9 in reply to:  8 Changed 10 years ago by jaubourg

Replying to anonymous:

This is still broken in 1.7.2 when using 'jsonp' dataType.

jsFiddle use-case please.

Note: See TracTickets for help on using tickets.