Having a really hard time with this problem, I know that $.when() can be used this way (with several AJAX statements) to promise you when they are all done.
http://jsfiddle.net/M93MQ/
$.when( $.ajax({ url: '/echo/html/', success: function(data) { alert('request 1 complete') } }), $.ajax({ url: '/echo/html/', success: function(data) { alert('request 2 complete') } }) ).then( function () { alert('all complete'); });
But this only works with raw $.ajax() , anyway, has the same functionality with function calls , which, in turn, have ajax inside them (and other random logic)?
Pseudo-code idea:
// The functions having the AJAX inside them of course $.when(ajaxFunctionOne, ajaxFunctionTwo).then(function () { alert('all complete'); });
source share