jQuery:deferred.always()和deferred.then()之间有什么区别? [英] jQuery: What is the difference between deferred.always() and deferred.then()?
本文介绍了jQuery:deferred.always()和deferred.then()之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
对我来说,两者都做同样的事情。
Seems to me that both does the same thing.
文件:
推荐答案
看起来 deferred.then()
允许您为成功和失败传递两个单独的回调,而 deferred.always()
需要 n
无论初始事件的结果如何,都将调用所有回调。
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.
我想说使用 deferred.always()
在初始事件的成功/失败不重要的情况下
I would say use deferred.always()
in the cases where success/failure of the initial event are not important
这篇关于jQuery:deferred.always()和deferred.then()之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文