admin管理员组文章数量:1394988
If I have three functions a, b, and c
:
function a() {
var deferred = new $.Deferred();
// stuff -- resolve deferred once async method is plete
return deferred.promise();
}
a().then(b)
This works fine, but how could I also call function c
after a
is finished?
Something like:
a().then(b,c)
If I have three functions a, b, and c
:
function a() {
var deferred = new $.Deferred();
// stuff -- resolve deferred once async method is plete
return deferred.promise();
}
a().then(b)
This works fine, but how could I also call function c
after a
is finished?
Something like:
a().then(b,c)
3 Answers
Reset to default 4Mostly in all cases, you could use done():
a().done(b, c);
You can call the both function at the same time using a
s callback function.
a().then(function () {
b();
c();
});
You can chain them
a().then(b).then(c)
Demo: Fiddle
本文标签: javascriptjQuery then() call two functionsStack Overflow
版权声明:本文标题:javascript - jQuery .then() call two functions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744108864a2591194.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论