I work with an application which sends some requests to server.
function createAjaxCall(data, done, fail) {
return $.post("process_watch.php", data).then(done).fail(fail);
}
and
function step1() {
return createAjax({ }, function(result) { console.log(result); return result; }, function() { });
}
function step2(res) {
return createAjax({ }, function(result) { console.log(result); return result; }, function() { });
}
...
Some requests take a while (let's assume that I use sleep(1500);
in PHP) and if I do:
step1().then((data) => step2(data)).then((data) => step3(data))
then will execute in same time.
What is going wrong ?