Is it possible to hook into the ajax wait system?

Is it possible to hook into the ajax wait system?

Is it possible to detect when a page has an ajax request thats still in progress?

I'd like to conditionally show/hide or enable/disable certain functionality or content based on whether an ajax request is currently in progress.  I know the ajax wait widget shows the standard "loading" piece of feedback when a request is taking a while so I wondered whether there was exposure of the data it uses (ie. whether ajax requests are in progress, how long for, etc..) so that it could be used for other things?

The javascript below is used by RichWidget's Feedback_AjaxWait web block. If you bind your javascript code to the same events, you may be able to do what you're describing. For instance:


will display an annoying popup before each ajax request.

var RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer;
var RichWidgets_Feedback_AjaxWait_Timeout = 200;

function RichWidgets_Feedback_AjaxWait_init(divId) {
 $(function($) {
    if(RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer == null) {
       RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer = setTimeout(function () { 
            $('#' + divId).fadeIn(); 
        } , RichWidgets_Feedback_AjaxWait_Timeout);
      window.OsOnBeforeChange = function(){
       RichWidgets_Feedback_AjaxWait_ajaxWaitMessageTimer = null;
       $('#' + divId ).fadeOut();
      $(window).unload(function() {
       window.OsOnBeforeChange = null;

Disclaimer: keep in mind that this API can change in future platform versions.
Thanks, that looks promising and i think i'll be able to use it for my needs.