title: how to call a function after a set of multiple ajax request complete on jquery?
body: <p>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.</p>
  
  <p>I want to call a function once all the ajax requests are complete as each would take different timespan depending on various aspects.</p>
  
  <p>I tied jQuery <a href="http://api.jquery.com/jQuery.when/" rel="nofollow">http://api.jquery.com/jQuery.when/</a> but the function in the <code>.then()</code> gets called immediately.</p>
  
  <p>Here is what I tried :</p>
  
  <pre><code>$.when(GetAjaxData(someUrl1), GetAjaxData(someUrl2), GetAjaxData(someUrl3)).then(alert("done"), alert("not done"));
  </code></pre>
  
  <p>is there any other approach that you can think of?</p>