title: PHP, jQuery & Ajax calls out of order
body: <p>I am using jQuery for my Ajax calls... I have x amount of Ajax calls that append to a div. These Ajax load requests are generated by a PHP foreach loop... The problem is they render out of the order; they are set in the array...</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  function loadPage(target, url, append)
  {
      if (append == true) {
          $.get(url, function(data) { $(target).append(data) });
      }
      else {
          $(target).load(url);
      }
      return false;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>////// ----- PHP</p>
  
  <pre><code>&lt;?php
      $this-&gt;data['sidebar']  = array('login', 'active_leagues', 'latest_forum_threads', 'latest_matches', 'sponsors');
  
      if (isset($sidebar[0]) &amp;&amp; !empty($sidebar[0]))
      {
          echo '&lt;div class="right_col"&gt;';
          foreach($sidebar as $val)
          {
              echo "&lt;script&gt;loadPage('.right_col', 'http://dev.banelingnest.com/sidebar/". $val ."', true)&lt;/script&gt;";
          }
          echo '&lt;/div&gt;';
      }
  </code></pre>
  
  <p>I am wonder if the cause of this is the web server responding slower to some requests than others... Other than that, I have no clue why this could be happening. Do you have any thoughts how I could keep the requests in order?</p>