0

I'm just trying to get my head around the details of deferred.
Why doesn't the following make the two calls syncronous?

http://jsfiddle.net/JSw5y/889/

Console output:
Running ajax get
Fading in
Fading in done
Finished running ajax get

Desired output:
Running ajax get
Finished running ajax get
Fading in
Fading in done

Carl R
  • 8,104
  • 5
  • 48
  • 80

1 Answers1

3

It doesn't work because in this line:

.then(showDiv())

you're calling showDiv immediately, not passing it as a callback to .then(). It should read:

.then(showDiv)
Alnitak
  • 334,560
  • 70
  • 407
  • 495