Show Update Progress on JavaScript function call

If we have defined Update Progress with Update Panel, this magic works automatically. In case, you want to show this explicitly, you need to write some code with help of Script Manager. The below lines of script code will do the job what we want. We need to place below script inside a <script type="text/javascript">…</script> 

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);

function BeginRequestHandler(sender, args) 
{
   var state = document.getElementById('myProgressDivID').style.display;
   if (state == 'block') 
       {
          document.getElementById('myProgressDivID').style.display = 'none';
        } 
   else 
       {
          document.getElementById('myProgressDivID').style.display = 'block';
        }
   args.get_postBackElement().disabled = true;
}

Cheers!!!