Is there any way to listen for javascript function to exit? A trigger that can be configured at the end of a function?
I am trying to use the user interface obfuscation method (BlockUI) while the AJAX object retrieves data from the database, but the function is not necessarily executed last, even if you put it at the end of the function call.
Example:
function doStuff() {
blockUI();
ajaxCall();
unblockUI();
};
Is there a way to make doStuff to listen to ajaxCall before running unBlockUI? Be that as it may, it processes the function linearly, calling each object in order, then a separate thread is generated to complete each of them. Thus, although my AJAX call may take 10-15 seconds, I block the user for only a split second due to the linear execution of the function.
There are less elegant ways around this ... to end the loop only when the return value set by the AJAX function is set to true or something like that. But it seems unnecessarily complicated and inefficient.
source
share