I am trying to use jQuery to read all text files in a folder and display their contents, but then a filter that should be displayed based on the folder name.
Here's the javascript:
var obj = {
"01600610/9874565214_789545621.txt": "",
"01600610/9874565214_789545622.txt": "",
"01600610/9874565214_789545623.txt": ""
};
$.each( obj, function(SavedText) {
$.get(SavedText, function(data){
$('#NewMessagesHolder').prepend('<div class="MessageClass">'+ '<span class="ChatName">' + CookieName + ' ('+ time + ')</span>' + ': '+ data +'</div>')
}, 'text');
});
In that:
var obj = {
"01600610/9874565214_789545621.txt": "",
"01600610/9874565214_789545622.txt":"",
"01600610/9874565214_789545623.txt":""
};
Q1 : How to get all the text files inside the folder instead of specifying the file I want?
Q2 : How can I filter? For example, how can I get only files ending or beginning with 789545.
source
share