Side navigation
#14011 closed bug (notabug)
Opened June 12, 2013 01:48AM UTC
Closed June 23, 2013 03:39PM UTC
done/fail/always callbacks not called for HTTP status code 202
Reported by: | anonymous | Owned by: | |
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 2.0.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
My server returns status code 202 upon successful DELETE request. My client code makes a jQuery AJAX call to issue DELETE request. I tried all combinations of including done/fail/always and success/error/complete callbacks. I see that done/fail/always callbacks are never called, but success/error/complete are called. I also included a callback for statusCode 202, and I see that was called AFTER the success callback was called.
Since success/error/complete callbacks are deprecated, it seems to me that done/fail/always callbacks should be executed in this scenario instead.
The documentation at http://api.jquery.com/jQuery.ajax/ also does not document when statusCode callback will be invoked.
Attachments (0)
Change History (4)
Changed June 12, 2013 04:06AM UTC by comment:1
Changed June 12, 2013 07:35PM UTC by comment:3
Thank you, this addresses my issue. If you could include some or all of this information in the documentation, that would be helpful.
Changed June 23, 2013 03:39PM UTC by comment:4
resolution: | → notabug |
---|---|
status: | new → closed |
The docs seem clear enough, further clarification can be had by asking targeted questions on our forum or StackOverflow. Making the ajax docs longer to clarify obscure points will make it harder to understand.
A jsfiddle example would help a lot but my guess is you're using
done
/fail
/always
like options:But
done
/fail
/always
aren't options, they're methods of the returned jqXHR object:The
success
/error
/complete
that are deprecated are the *methods* too, not the options.Regarding
statusCode
, the documentation states:So a statusCode callback will always be called regardless of the success/error status of the ajax call. Exact, relative timing, isn't given nor should it (because you shouldn't rely on it) but callbacks are called in the order they are added. For options callbacks, I don't remember which comes first though between complete and statusCode callbacks but success/error will be called prior to anything else.
For exact ordering, use the methods.