In my JS, I need to get the contents of 3 files with AJAX, then do some code. This has led to a rather strange looking creation of nested async functions. Also anytime I\'m
Create an array of each needed file, then loop through the array of files and call $.get each iteration, and have it call a combining function that will combine the data and do a count check, once count is reached call callback.
function loadData(files,callback){
var combinedData = "";
var count = 0;
function combineFile(data){
count++;
combinedData += data;
if(count==files.length-1){
callback(combinedData);
}
}
for(var i=0; i