Javascript method chaining
<p>Didn't know how else to put this.</p>

<p>Say I have a Javascript method that makes some AJAX calls:</p>

<pre><code>function makeAJAXCalls()
{
    // who knows how long this will take
}
</code></pre>

<p>And I don't want the next function to execute until all the AJAX calls are complete. I also don't want to put the next function call into the success callback for the AJAX call.</p>

<p>Is there a way I can like chain these, so the next funtion doesn't get called until <code>makeAJAXCalls()</code> is done everything it needs to do?</p>

<p>Thanks.</p>
