title: Populate multiple divs through one AJAX call
body: <p>I'm trying to make one AJAX call to another page on my site and grab the contents of two different divs. </p>
  
  <p>For example: 
  Another page on my site has this content</p>
  
  <pre><code>&lt;div id="firstDiv"&gt;Content of first div&lt;/div&gt;
  &lt;div id="secondDiv"&gt;Content of second div&lt;/div&gt;
  </code></pre>
  
  <p>I want to make a single AJAX call to grab the contents of both of these divs. 
  I've tried doing something like this:</p>
  
  <pre><code>$.ajax({
     url: myPageURL,
     success: function (contents) {
       if ($(contents).find('#firstDiv').length &gt; 0) {
         var firstDivContents = $(contents).find('#firstDiv').html();
         $(firstDivContents).prependTo('#Col1');
       }
       if ($(contents).find('#secondDiv').length &gt; 0) {
         var secondDivContents = $(contents).find('#secondDiv').html();
         $(secondDivContents).prependTo('#Col2');
       }
    }
  </code></pre>
  
  <p>});</p>
  
  <p>The first IF statement runs and populates my info as expected, but the second IF statement does nothing. If I comment out the first IF statement, the second one runs fine.  </p>