【发布时间】:2013-12-26 11:47:02
【问题描述】:
我想获取文件列表(来自名为uploads 的文件夹。
get_files.php
<?php
$dir = 'uploads/';
$a = scandir($dir);
$b=count($a);
for($x=2;$x<$b;$x++)
{
echo"<div class='filePass'>";
echo $a[$x];
echo "</div>";
}
?>
get_files.php 单独工作时效果很好,即它可以正确列出文件。
但是我怎样才能得到insideT div 里面的列表呢?
我可以包含 get-files.php 但我需要使用 jquery ajax 来执行此操作,因为稍后会重用该函数。
function get_files(){
$.ajax({
url : 'get_files.php',
type : 'get'
});
$('#insideT').html(//here I want to get the file listing);
}
get_files();
【问题讨论】: