Call php from javascript and return an array from php to Javascript function
<p>I want to write a function in javascript which will call the Getfilename.php and Get the $filesArray that is return in javascript.</p>

<p>GetFilenme.php is another file and I am trying to access this from Config.html</p>

<p>PHP :
Getfilename.php </p>

<pre><code>&lt;?php
$dir = 'uploads/';

$dir = $_REQUEST['dir'] ;

$filesArray = array();
$Counter = 0;
$files = scandir($dir);
foreach ($files as &amp;$file)
{
 if ($file!='.' &amp;&amp; $file!='..' )
 {
  $filesArray[$Counter] = $file;
  echo $filesArray[$Counter].'&lt;br&gt;';
  $Counter = $Counter + 1;

 }
}
return $filesArray;
?&gt;
</code></pre>
