jQuery
$.ajax({
type:"POST",
url:"target.php",
dataType:"json",
async:false,
success:function(result){
//將Array 的 "." 及 ".." 移除
result.splice($.inArray('.',result),1);
result.splice($.inArray('..',result),1);
console.log(result);
}
})
PHP
<?php
$listArr = scandir('folderName/');
echo json_encode($listArr);
?>