Skip to main content

Bug Tracker

Side navigation

#7995 closed bug (invalid)

Opened January 17, 2011 11:09PM UTC

Closed February 01, 2011 07:45AM UTC

ajax query of type jsonp, when response is an http 204, does nothing.

Reported by: Owned by:
Priority: undecided Milestone:
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:

If you make an ajax request of type jsonp, and the response is an http-204 response code (which specifies no body content), neither the success nor the error handler are called.

I stepped through a debugger with jquery 1.4.4, and hit this code.

6000 // Make sure that the request was successful or notmodified
6001 if ( status === "success" || status === "notmodified" ) {
6002     // JSONP handles its own success callback
6003     if ( !jsonp ) {
6004         jQuery.handleSuccess( s, xhr, status, data );
6005     }
6006 } else {
6007     jQuery.handleError( s, xhr, status, errMsg );
6008 } 

It appears that if the status is a success, and it is not a jsonp request, nothing happens -- after stepping through a bit more the function simply returns.

Earlier during the global eval, since it is a 204 response, data = "", and thus there is no jsonp callback function named to call.

Is this expected behavior? I would think in the case of a jsonp request, if there is no content (and thus no function named to call back into), the error handler should be called.

Attachments (0)
Change History (2)

Changed January 17, 2011 11:11PM UTC by rwaldron comment:1

owner: →
status: newpending

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

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

Changed February 01, 2011 07:45AM UTC by trac-o-bot comment:2

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!