Say I've got folder "../cars/" that holds multiple html files, and I want to load all of these files into another html file.
I could easily go about this by doing something like:
$(document).ready(function (){
$("#all_cars").load("../cars/civic.html");
$("#all_cars").load("../cars/durango.html");
$("#all_cars").load("../cars/mustang.html");
$("#all_cars").load("../cars/r8.html");
... and so on
});
But I'd like to do this in a more sophisticated manner. I also don't want to have to code the file names into my js file. I'd rather be able to remove the file from the folder and now have it load anymore. Is there a way I could get all the filenames in the cars folder and loop over them to load?
Kind of like this:
foreach(cfn in carsFilesNames){
$("#all_cars").load("../cars/" + carsFileNames);
}