Is there a way to give jquery a path and it would return list of all subfolders in given path?
I have this, which returns all pics from the folder:
var folder = "photos/";
$.ajax({
url : folder,
success: function (data) {
$(data).find("a").attr("href", function (i, val) {
if( val.match(/\.(jpe?g|png|gif)$/) ) {
$('#links').append(
'<a href="' + folder + val + '" title="' + val + '">' +
'<img src="' + folder + val +'" class="photos"></a>'
);
}
});
}
});
Just need proper regexp for "ends with /"