i tried to display all images in one directory using following jquery
. But it is not working. My folder structure is just a images folder and js
folder.
I just followed this question also, but couldnt achive the target.
< script >
$(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)$/)) {
$("body").append("<img src='" + folder + val + "'>");
}
});
}
});
}); < /script>
<!DOCTYPE html>
<html>
<head>
<script src="js/jquery.min.js"></script>
</head>
<body>
</body>
</html>