I'm trying to create a list of files on filesystem, needed to fill a html. I also searched the net but can not find anything to implemetare this request only with the browser, and then only on the client side, also for security reasons. For now, the only way through which I can retrieve a list of files in a path, is using a Web server apache. Below is the code:
var dir = "path/";
var fileextension = ".mp3";
$.ajax({
//This will retrieve the contents of the folder if the folder is configured as 'browsable'
url: dir,
success: function(data){
$(data).find("td > a").each(function(){
// will loop through
var elemCurrent = decodeURI($(this).attr("href"));
if (elemCurrent.indexOf(".mp3") >= 0)
$("#selectId").append($("<option value=\"" + elemCurrent + "\">" + elemCurrent + "</option>"));
});
}
});
Do you know any way to do that only via jquery, so get list of file with jquery? Thank's