jQuery - getJSON data to array
<p>How do you store the data received from jQuery getJSON to an array for later usage? </p>

<p>Here's a sample snippet - somehow the loop's <code>data</code> is not being stored to the global <code>haikus</code>.</p>

<pre>
<code>
$(document).ready(function(){
    var haikus=[];
    alert("begin loop");
    $.getJSON('http://haikuennui.com/random.php',function(data){
         var i=0;
         for(i=0;i&lt;data.length;i++){
            haikus[i]=[data[i].id,String(data[i].username),String(data[i].haiku)];
        }
            alert(haikus[0][1]);
    });
})
​
</code>
</pre>

<p><a href="http://jsfiddle.net/DMU2v/" rel="nofollow">http://jsfiddle.net/DMU2v/</a></p>
