我将页面上传到服务器,当我尝试从文件夹中拍照时,会出现403(禁止)错误。当我在本地主机上尝试它时,它可以工作。
var dir = "color/real";
var fileextension = "230x128.jpg"
$.ajax({
url: dir,
success: function(data){
alert("succes");
$(data).find("a:contains(" + fileextension + ")").each(function () {
var filename = this.href.replace(window.location, "").replace("http:///", "");
var name = this.href.replace(window.location, "").replace("http:///", "").replace(/\_/g, " ").replace(/230x128\.jpg/g, "");
var custom = '<div class="thumbnail color b' + alpha[classIndex] + '" style="background-image:url(' + dir + filename + ')"><div><p>' + name + '</p></div></div>';
$("#parent").append(custom);
});
}
});
});