title: Jquery: Appending data to a div AFTER ajax load operation
body: <p>I have a setup much like this:</p>
  
  <pre><code>$('.container a').click(function(event) {
      event.preventDefault();
      $('#contents').remove();
      $(this).parent().append("&lt;div id=\"contents\"&gt;&lt;/div&gt;");
      $('#contents').html('&lt;img src="/images/loading.gif" /&gt;')
                    .load("stuff.html")
                    .append("&lt;div id=\"closebutton\"&gt;&lt;/div&gt;");
  });
  </code></pre>
  
  <p>However, the 'append' part seems to run before the load is completed, so that the closebutton div gets overwritten by the contents of stuff.html. How do I make it wait until the ajax operation has completed before performing the final append?</p>
  
  <p>Thanks :)<br>
  Mala</p>