Good day everyone. Please tell me how to solve this problem. There are 5 elements on page, which, when I click on a button, I have to update, using ajax requests, and immediately after updating all 5 fields, run the following function. I made a global variable count = 5 , and in the ajax request block for success , I decrement the global variable. But as I continue to hang a monitor or something in its likeness, which will be able to monitor this variable. Use callback, I understand it is useless here.
- oneif you can reduce the variable, then you can probably check it to 0 too? or you can make it an object with a setter that checks. - teran
- I can check on 0, but functions with ajax requests work not only in this implementation. - Alexey
- api.jquery.com/jQuery.when - teran
- learn.javascript.ru/promise#parallelnoe-vypolnenie or simply Promise.all - Nikita R.
- All this is good, but not just ajax requests come to me, let's say functions are started, in which there is a certain implementation after ajax is started. - Alexey
|