title: jQuery .push into an Array in a .get call gives an empty result
body: <p>Can anyone tell me why the below gives me an empty string? When I <code>console.log(contentArray)</code> in the <code>$.get()</code> callback function it shows the data but when I try to do it where it is in the code below, the result is empty.</p>
  
  <pre><code>sectionArray = [];
  contentArray = [];
  $(function () {
      if (index == 1) {
          $('menu:eq(' + (section - 1) + ') li a').each(function () {
              sectionArray.push($(this).attr('href'));
          });
  
          var len = sectionArray.length;
  
          for (var i = 0; i &lt; len; i++) {
              href2 = sectionArray[i];
  
              $.get(href2, function (data) {
                  string = data.toString();
                  contentArray.push(string);
              });
          }
          content = contentArray.toString();
          console.log(content);
      }
  </code></pre>