title: consecutive, not concurrent jQuery AJAX posts
body: <p>I'm probably missing something obvious, but I don't seem to be able to get my AJAX posts to run consecutively instead of concurrently with jQuery.</p>
  
  <p><code>ad_numbers</code> is an array of numeric IDs.</p>
  
  <pre><code>$(ad_numbers).each(function() {
    ad_number = $.trim(this);
  
    if(!ad_number) { return true; }
  
    $.post('/fetch.php', { ad_number: ad_number }, function(data, textStatus) {
      $('#log').prepend('&lt;p&gt;' + data + '&lt;/p&gt;');
    });
  });
  </code></pre>
  
  <p>In <code>fetch.php</code>, I've had it <code>sleep(2)</code> so I can make sure it works correctly. Instead of waiting for the first POST to go through before stepping on to the next ad number in the array, it seems to be running all of them at once concurrently.</p>
  
  <p>I'm guessing <code>$.post()</code> is returning before it completes? What's the best way to avoid this?</p>