jQuery: What is the difference between deferred.always() and deferred.then()?

后端 未结 4 1851
离开以前
离开以前 2020-12-29 04:03

Seems to me that both does the same thing.

Docs:

  • deferred.always()

  • deferred.then()

4条回答
  •  甜味超标
    2020-12-29 04:30

    It would seem that deferred.then() allows you to pass two separate callbacks for success and failure, whereas deferred.always() takes n number of callbacks which will all be called regardless of the outcome of the initial event.

    I would say use deferred.always() in the cases where success/failure of the initial event are not important

提交回复
热议问题