-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot chain $.ajax() using .then() #12
Comments
It looks like the done() argument is being called before the second promise has yet resolved, it is not ajax-specific: Zepto+simply-deferred: http://jsfiddle.net/69eNF/
jQuery: http://jsfiddle.net/69eNF/3
Note that in the simply-deferred version that allDone ("secondPromise resolve with...") is called before the secondPromise has actually resolved |
Think this might be a bug... will look into it. |
This should be fixed in PR #13 . Can you take a look and confirm? |
Can't speak to the original poster, but for me the fix_12 branch now works in Firefox 22/mac, Safari 6.05/mac and Chrome 28/mac |
Thank you... Will merge it in and release v2.1. The problem was that the 'then' method affords no special treatment to callbacks that return promises. Had to go read the jQuery docs again to realize it checks the type of the returned value and sets up resolution for it. — On Wed, Jul 10, 2013 at 9:26 AM, Levi Cameron notifications@github.com
|
Fixes #12. Checking if filters return a promise and resolving / rejectin...
I'm using chromium 26 browser in Gentoo Linux.
Suppose we have JavaScript code such as
and each URL returns JSON as follows:
/data1 returns {"data":"one"}
/data2 returns {"data":"two"}
In jQuery 1.9.1, output of console is
This is the expected behavior at least for me.
However, output of Zepto 1.0.0 + simply-deferred is
Is this a bug? Or am I doing something wrong?
I want to get /data2 after getting /data1, and obtain the result of /data2.
Is there any way to do it in same code for jQuery and Zepto + simply-deferred ?
The text was updated successfully, but these errors were encountered: