I have three AJAX calls and I want them to execute them sequentially. How to implement this?
I wrote an article on sequential task execution (using promises) in 2013. Take a look.
If you are using Nodejs, You can use Fibers and make it sequential. Looks much more elegant. If not, you can use this plugin!!! http://foliotek.github.io/AjaxQ/
Make the second AJAX call inside the callback of the first AJAX call.
Mutyalarao
Programmer | Node.js | Learner| Doer
Hi Shankar,
I can think of using "Promises".
developer.mozilla.org/en-US/docs/Web/JavaScript/R… http://spion.github.io/promise-nuggets/ http://bluebirdjs.com/docs/getting-started.html
The code would look like.
call1() .then( val => { return call2(); }) .then(val => { return call 3(); }) .then(val => { //the end })