return Array To Functions with AJAX
<p>i just want to ask if how to return or how to call the returned arrays to the function..</p>

<p>this is my javascript</p>

<pre><code>$(document).ready(function(){
alert(askServer());   

function askServer()
{
 var strUrl = "functions.php";
 var strReturn = new Array();

 jQuery.ajax({
  url:strUrl, success:function(html){strReturn = html;}, async:false
 });

 return strReturn;
}
});
</code></pre>

<p>and this is from my functions.php..</p>

<pre><code>&lt;?php
$dirArray = Array('data_1','data_2','data_3');
echo $dirArray;
?&gt;
</code></pre>

<p>my problem is it will alert the word "Array"/...</p>

<p>can it be done like this?</p>

<pre><code>alert(askServer()[0]);
</code></pre>

<p>to alert "data_1"?</p>
