var fileNames = new Array();
$.ajax({
url: "./dataset/case6", //目标目录路径
success: function (data) {
$(data).find("a:contains(.json)").each(function () {
let tmp = $(this).attr("href");
let idx = tmp.lastIndexOf('/');
tmp = tmp.slice(idx + 1, tmp.length);
fileNames.push(tmp);
});
var reg = /.*(?=\.json)/;
fileNames.sort((x, y) => { //对文件名进行排序
x = x.match(reg)[0];
y = y.match(reg)[0];
return parseInt(x) - parseInt(y);
})
})