📜  如何使用 javascript 代码示例扫描文件夹中的文档

📅  最后修改于: 2022-03-11 15:04:14.681000             🧑  作者: Mango

代码示例1
var dir = "/videos";
var fileextension = ".mp4";
$.ajax({
    //This will retrieve the contents of the folder if the folder is configured as 'browsable'
    url: dir,
    success: function (data) {
        // List all mp4 file names in the page
        $(data).find("a:contains(" + fileextension + ")").each(function () {
            var filename = this.href.replace(window.location.host, "").replace("http:///", "");
            $("body").append($(""));
        });
    }
});