以下是我在localhost上100%工作的代码。但它在我托管时没有检索到任何内容。还有什么我应该做的吗?
var dir = "images/print/thumb/";
var fileextension = [".png", ".jpg", ".gif"];
$.ajax({
url: dir,
success: function (data) {
$(data).find("a:contains(" + (fileextension[0]) + "), a:contains(" + (fileextension[1]) + "), a:contains(" + (fileextension[2]) + ")").each(function () {
var filename = this.href.replace(window.location, "").replace("http:///", "");
var tag = '<div class="thumb_div"';
tag += 'style="height:150px; margin-right:10px; margin-bottom:8px; float:left; overflow:hidden; border:2px solid white; background-color:white;">';
tag += '<img class="thumb" id=' + filename + ' src=' + dir + filename;
tag += ' style="cursor:pointer; position:relative; margin:0; padding:0;"></img>';
$("#wrap").prepend(tag);
});
}
});