jquery accessing php jason_encoded array
<p>in test.php:</p>

<pre><code>&lt;?php
array_push($stack, "BLABLA");
array_push($stack, "BLABLA2");
echo json_encode($stack);
?&gt;
</code></pre>

<p>in test.html:</p>

<pre><code>&lt;script type="text/javascript"&gt;
$(document).ready(function(){
    $.post( 
    'test.php', // location of your php script
    {}, // any data you want to send to the script
    function( data ){  // a function to deal with the returned information
        $('#mydiv').html(data[0]).show();
    }, "json");
});
&lt;/script&gt;

&lt;div id="mydiv"&gt;&lt;/div&gt;
</code></pre>

<p>I have done some sanity checks and it seems that data[0] isn't the correct way to access the first element I pushed in php. So how can I do this?</p>
