Skip to content

Instantly share code, notes, and snippets.

@lezi
Created July 30, 2012 14:08
Show Gist options
  • Select an option

  • Save lezi/3207114 to your computer and use it in GitHub Desktop.

Select an option

Save lezi/3207114 to your computer and use it in GitHub Desktop.
Show Global Ajax Status
/**
* ***************************************
* Show busy status.
* Original from POST: http://ocpsoft.org/java/jsf-java/jsf2-how-to-create-a-global-ajax-status-indicator/
*/
if (!window["busystatus"]) {
var busystatus = {};
}
busystatus.onStatusChange = function onStatusChange(data) {
var status = data.status;
alert("ajax event triggered")
if (status === "begin") { // turn on busy indicator
document.body.style.cursor = 'wait';
} else { // turn off busy indicator, on either "complete" or "success"
document.body.style.cursor = 'auto';
}
};
jsf.ajax.addOnEvent(busystatus.onStatusChange);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment