Force Javascript function call to wait until previous one is finished
<p>I have a simple Javascript function:</p>

<pre><code>makeRequest();
</code></pre>

<p>It does a bunch of stuff and places a bunch of content into the DOM.</p>

<p>I make a few calls like so:</p>

<pre><code>makeRequest('food');
makeRequest('shopping');
</code></pre>

<p>However, they both fire so quickly that they are stepping on each other's toes.  Ultimately I need it to have the functionality of.</p>

<pre><code>makeRequest('food');
wait....
makeRequest('shopping'); only if makeRequest('food') has finished
</code></pre>

<p>Thoughts on getting these to execute only one at a time?</p>

<p>Thanks!</p>
