Bug Tracker

Opened 10 years ago

Closed 10 years ago

#5080 closed bug (invalid)

$.ajax 'error' and 'complete' callbacks ignore dataType.

Reported by: micah Owned by:
Priority: major Milestone: 1.4
Component: ajax Version: 1.3.2
Keywords: ajax complete callback datatype Cc:
Blocked by: Blocking:

Description

$.ajax will always pass the xhr to s.error and s.complete, without regard for the dataType argument (see http://dev.jquery.com/browser/trunk/jquery/src/ajax.js#L476).

I initially thought my code was screwy, as I expected the first argument of any callback to be the json response when dataType == 'json'. Is there a specific reason for this discrepancy in the API?

Change History (1)

comment:1 Changed 10 years ago by dmethvin

Resolution: invalid
Status: newclosed

Most likely because the easy case is when things go right. :)

All I can say is that it's working as documented, and I can't imagine it being changed since a lot of code depends on the current documented behavior. With that in mind I'll close the bug, but you could start a discussion on the jQuery-dev group.

Note: See TracTickets for help on using tickets.