I'm trying to display some images contained in a folder, inside a div. I'm using AJAX to do that in a JavaScript file called edit
that is one directory away from the index route. I'm using Node.js. The code I have written is as follows.
var folder = "../images/emojies/";
$.ajax({
url : folder,
success: function (data) {
$(data).find("a").attr("href", function (i, val) {
// some code
});
}
});
I get this error: "GET /images/emojies/ 404"
The weird thing is that when I go to this for example: "/images/emojies/image.png", It finds the directory with no errors! It's like it can't find folders but it can find files?
routing code if needed:
/* GET home page. */
router.get('/', function(req, res, next) {
res.render('index', { title: 'xx' });
});
/* GET edit page. */
router.get('/edit', function(req, res, next) {
res.render('edit', { title: 'xx' });
});