People who know me professionally that I have a natural aversion to the UI. I used to think that it was a natural aversion to javascript but later on I zeroed in to javascript UI stuff. This is me saying that whenever I can program the backend stuff and have other people do the frontend stuff I usually pull rank and have the junior devs do it.
Unfortunately or maybe fortunately sometimes they have trouble with research and have to man up and do some UI trouble shooting.
The main problem is that because the UI stuff are done by the junior devs the quality of code has a large variability in quality, meaning some code are crap.
I had to find a way to reliably determine if ajax request are done and prevent user action whenever it is still loading.
After a bit of reading through the jquery documentation I found these 4 functions, 2 pairs actually that can do the job if all are the requests are done through I believe the jQuery.
ajaxSend ajaxComplete ajaxStart ajaxStop
http://api.jquery.com/ajaxStart/
http://api.jquery.com/ajaxStop/
http://api.jquery.com/ajaxSend/
http://api.jquery.com/ajaxComplete/