Reputation: 2833
Here is an example:
function firstFun() {
var dfd = new $.Deferred();
return dfd.reject();
}
function secondFun() {
console.log('in secondFun');
}
console.log('start');
firstFun().then(secondFun());
Nevertheless I return dfd.reject()
the secondFun()
is fired.
the same with firstFun().done(secondFun());
Upvotes: 2
Views: 396
Reputation: 5631
Try firstFun().then(secondFun);
.then
and .done
expect function as parameters to be used as callbacks. But you're invoking secondFun
instead of just passing it (hence actually passing undefined
).
Upvotes: 11