Jquery .get and .push into an array gives an empty string
<p>Can anyone tell me why the below gives me an empty string?? When I console.log(contentArray) in the .get callback function it spits out the data but when I try to do it where it is in the code below it wont work.</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>
