I am calling multiple ajax requests at a time. I have a single function which calls the server and gets the response and processes it. Based on the parameters passed to it, I will decide what to be returned on the server side.
I want to call a function once all the ajax requests are complete as each would take different timespan depending on various aspects.
I tied jQuery http://api.jquery.com/jQuery.when/ but the function in the .then()
gets called immediately.
Here is what I tried :
$.when(GetAjaxData(someUrl1), GetAjaxData(someUrl2), GetAjaxData(someUrl3)).then(alert("done"), alert("not done"));
is there any other approach that you can think of?