I am trying to load images from folder via jquery and ajax and I'm using the solution provided here. However, this throws a 404 error - even though the directory definitely exists, and I even can access the files in it.
Here's the jquery code:
$(document).ready(function () {
var folder = "images/";
$.ajax({
    url: folder,
    success: function (data) {
        $(data).find("a").attr("href", function (i, val) {
            if (val.match(/\.(jpe?g|png|gif)$/)) {
                $('#galerie').append('<a class="image_anchor" data-fancybox="gallery" href="resources/img/header_bg.jpg"><img src="' + folder + val + '" /></a>')
            }
        });
    }
});
});
 
     
    