jquery / jquery/api.jquery.com

Undocumented jQuery.ajax() differences between .fail() and error callback.

Open
#429 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
HTML
Stars
325
Forks
260
PR merge metrics
No merged PRs in 30d

Description

On http://api.jquery.com/jquery.ajax/#jqXHR jqXHR.fail() it's described with these word:

jqXHR.fail(function( jqXHR, textStatus, errorThrown ) {});

An alternative construct to the error callback option, the .fail() method replaces the deprecated .error() method. Refer to deferred.fail() for implementation details.

An alternative construct suggests that using any of these methods will result in the same behavior. In fact they differ quite significantly, because error is not called when beforeSend returns false, while .fail() is called in that case, additionally with completely undocumented canceled status. It looks like all that stuff came with http://bugs.jquery.com/ticket/10944 and the changes it brought have not been documented at all.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the jqXHR.fail() section on http://api.jquery.com/jquery.ajax/#jqXHR and compare its description with the error callback behavior described in the issue. Review the behavior associated with bugs.jquery.com/ticket/10944, then document the beforeSend cancellation difference and the canceled status so the two APIs are no longer presented as equivalent.

Written by the indexing model from the issue text.

Assessment

Tech stack
jquery
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.