Neeraj Singh
Neeraj Singh

Reputation: 2146

Why Deferred is not working when resolve is inside a function

This code works http://jsfiddle.net/neerajdotname/k2Q9b/

But this code does not work http://jsfiddle.net/neerajdotname/k2Q9b/1/

Why?

And what's the fix?

Upvotes: 0

Views: 158

Answers (1)

grapefrukt
grapefrukt

Reputation: 27045

You are missing the paranthesis at the end of dfd.resolve:

 function func(){dfd.resolve;};

Should be:

 function func(){dfd.resolve();};

As it is now you are simply stating the name of the function, not actually calling it.

Upvotes: 1

Related Questions