The situation is as follows: Ajax returns an array and after that an ajax request is made for each element in this array, and for one element, another ajax request is made within one ajax request. I tried to depict it schematically.
ajax 1 success{ foreach array{ ajax 2 success { ajax 3 success { действие 1 } } ajax 4 success { действие 2 } ajax 5 success { действие 3 } } } It turns out that step 1 is executed at the very least, but it’s necessary that everything be done in order. How to allow execution of 2 and 3 actions only after the first one? Moreover, it may be that ajax 2 will not exist, and therefore putting 4 and 5 ajax requests into the success function ajax 3 is not an option.
async : false- Shadow33ajaxreturns promise - use it. - Grundy.then(function () { $ajax...then(function () { $ajax....then(function) {}})})- Vasily Barbashev