I uploaded my page to a server and when I'm trying to take photos from a folder it gives an 403 (Forbidden) error. When I tried it on a local host it worked.
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);
});
}
});
});