Displaying SharePoint’s “Please wait…” or “Working on it…” dialog box

The following code helps in displaying the “Working on it…” dialog box available in SharePoint 2013 or SharePoint Online.

Before you being the background operation, call the function “RequestStarted“. Once the background operation has been completed, call the function “RequestEnded“.

function RequestEnded(sender, args) {
    try {
        waitDialog.close();
        waitDialog = null;
    } catch (ex) {}
};

function RequestStarted(sender, args) {
    var waitDialog;
    ExecuteOrDelayUntilScriptLoaded(ShowWaitDialog, "sp.js");
};

function ShowWaitDialog() {
    try {
        if (waitDialog == null) {
            waitDialog = SP.UI.ModalDialog.showWaitScreenWithNoClose('Processing...', 'Please wait while request is in progress...', 120, 440);
        }
    } catch (ex) {}
};

Source: Sharepoint Stackexchange


Leave a Reply

Your email address will not be published / Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.