jquery - Returning a list of directories, and then printing off every image for every instance of a directory with AJAX -
i'm attempting create kind of file tree jquery , ajax looks through directory, finds every instance of folder , create loop returns name of every file within each iteration of folder.
someone else able tell me "an ajax call never triggers ajax call" , loop logistically couldn't work. guess i'm asking how else i'm supposed pull off.
the following stripped-back version of code.
dir = 'images/'; fol = []; file = []; // finds every instance of folder, inserts array $.ajax({ url: dir, success: function(data) { $(data).find('a:contains("/")').each(function() { fol.push(this.href.replace(window.location.host, "").replace("http:///", "").split('/')[1]); }); } }); // (i'd to) find every instance of image, return filename , insert array (var = 0; < fol.length; i++) { $.ajax({ url: dir + fol[i], success: function(data) { $(data).find('a').each(function() { file.push(this.href.replace(window.location, "").replace("http:///", "")); }); } } }); }