title: Queuing a series of ajax requests as they are triggered
body: <p>I am looking to queue a series of AJAX requests using JQuery.
  Suppose there is a function updateImage() that queries the server for a URL based on a button the user clicks, and returns a link to an image.
  The server records imageId, and the browser displays the image. This application requires the order of success callback functions to trigger in the order they were sent (so that the browser displays the images corresponding with the user's click order).</p>
  
  <p>To illustrate:</p>
  
  <pre><code>//User a number of buttons in quick succession
  $(".button").click(function(){
      var imageId = $(this).attr("id");
      updateImage(imageId);               
  });
  
  //Ajax success callbacks need to run in the order of the clicks
  function updateImage(imageId) {
      $.ajax({
      url: /someurl,
      data: imageId,
      success: successFunction    //this function will update the DOM
    });
  }
  </code></pre>
  
  <p>I have considered $.ajaxStop, but the issue is that there are other AJAX functions that I don't want to be halted or queued because of this updateImage function. I have also looked at $.when, but that allows you to chain a known number of executions of ajax calls, but I'm not sure how many times a user will click -  I'm not sure that applies here.</p>