I repeat the array of command files using for each method.
With each batch file, I need to wait for ajax to succeed before continuing with the next command.
The problem is that for each cycle, moving to the next command before completing the ajax code. Can anyone suggest a solution?
For each cycle:
$.each(cmd_files, function(index, cmd) {
update_log('Running CMD for' + cmd)
wait_for_cmd_complete(cmd).done(function(data){
update_log("CMD is complete");
})
})
Ajax Function:
function wait_for_cmd_complete(cmd){
return $.ajax({
type: 'POST',
data: {cmd:cmd},
url: 'wait_for_cmd_complete.php'
});
}
source
share