Deprecated jQuery callbacks - clarification?

Since jQuery 1.5 - the jqXHRobjects returned $.ajax(), implement the interface Promise.

docs also state that jqXHR.done, jqXHR.fail, jqXHR.alwaysare alternative designs for obsolete success / fail/ completerespectively.

Wear Notification: jqXHR.success (), jqXHR.error (), and jqXHR.complete () callbacks are deprecated as of jQuery 1.8. To prepare your code for their possible removal, use jqXHR.done (), jqXHR.fail (), and jqXHR.always ().

ok (long known)

But then I saw a asyncdoc:

async: As with jQuery 1.8, use async: falsewith is jqXHR ($.Deferred)deprecated; you should use the success / error / full response parameters instead of the corresponding jqXHR object methods, such as jqXHR.done()or deprecated jqXHR.success().

The wording here is very unclear (imho) - so I do not understand the meaning of this.

Question:

Are there any situations in which I still need to use success/error/complete? How so? they are out of date!

nb why all this mess? they change and delete methods and replace (! eg pipe, then), like every version

+4
source share
1 answer

Output:

, , API async: false jqXHR ($.Deferred) ( ).

success/error/complete $.ajax() .

jqXHR.success(), jqXHR.error() jqXHR.complete() .

async AJAX (async: true) success/error/complete $.ajax() , jqXHR.done, jqXHR.fail, jqXHR.always.

AJAX (async: false), API (jqXHR.done, jqXHR.fail, jqXHR.always), success/error/complete $.ajax().

+4

Source: https://habr.com/ru/post/1532439/


All Articles