Using the abortPostBack() Method

Listing 1. Abort an asynchronous postback request using the PageRequestManager class's abortPostBack() method.

function btnAbort_Click()
{
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    if (prm.get_isInAsyncPostBack())
    {
        prm.abortPostBack();
        alert("Postback aborted!");
    }
    else
    {
        alert("No postback operation is in progress.");
    }
}