I've done my first AJAX call but since the documentation isn't clear
about how parameter passing is done, it's not working on the first
try. My code

=========================
  var files = new Array();

  $.getJSON ("getfiles.php",
             {basedir: "gallery"},
             function (data){
               alert ('Data='+data);
               files = data;
             }
   );

=========================
<?PHP // getfiles.php
  $folders = recurseDir ($_GET['basedir'], false);
  $files = array();
  if (count ($folders) > 0) {
    foreach ($folders as $key => $d) {
      $files = array_merge ($files, getFiles ($d));
    }
  }
  echo $json->encode ($files);
?>

How do I copy the Json data into array files? The code can be tried at
http://www.orpatec.ch/gallery4.html

O. Wyss

Reply via email to