Similar to the question I just asked,
If I call an ajax function in jQuery and then a non ajax function how can I prevent the non-ajax function from firing until after the first ajax callback function has completed. Will declaring async: false in the first ajax function be enough?
If you’re talking about this:
where
someFunction()won’t occur until the AJAX call completes then you have three options:async: false. Don’t do this. It’ll make your page unresponsive;someFunction()in the complete/success/error callbacks of the AJAX call. This is the recommended approach; orThe first A in AJAX stands for “asynchronous”. You just need to get used to the fact that these calls are asynchronous and stop trying to force a synchronous programming model on top of them. Adapt to the new programming model.