The ajax on the promise2 is not running until the first ajax is completed. I need both of these to run at the same time. When mixexport_exe is called, it will run promise2 every 500ms.
function mixexport_exe(opn) {
mixdownactive = 1;
getid('tool_mix_area').innerHTML = 'loading...';
const promise1 = new Promise((resolve, reject) => {
$.ajax({
url: 'includes/ffmpeg_export.php?callFunction=mixexport_exe&version_id=<?=$version_dta[id] ?>&version_creaid=<?=$version_dta[version_id] ?>&exeoption=' + opn,
success: function(data) {
getid('tool_mix_area').innerHTML = data;
resolve(data);
},
error: function(error) {
reject(error);
}
});
});
const promise2 = new Promise((resolve, reject) => {
setInterval(() => {
$.ajax({
url: 'includes/ajax.php?callFunction=getrenderstatus',
success: function(data) {
console.log(data);
},
error: function(error) {
reject(error);
}
});
}, 500);
});
Promise.all([promise1, promise2])
.then((values) => {
console.log(values);
})
.catch((error) => {
console.error(error);
});
}
``