Loading Screen During Ajax Call

  1.  $.ajax({  
  2.         type: "POST",  
  3.         beforeSend: function (msg) {  
  4.             $('#loader').show()      //start loading screen;
  5.         },  
  6.         url: "CreateCustomer.aspx/GetCustomerDetails",  
  7.         data: '{"ID":"0","Status":"' + $("#CustStatus").val() + '","PageNumber":"' + $('.PText').val() + '"}',  
  8.         contentType: "application/json; charset=utf-8",  
  9.         dataType: "json",  
  10.         asnyc: false,  
  11.         complete: function () {  
  12.            $('#loader').hide();  //end loading screen;
  13.         },  
  14.         success: function (data) {  
  15.     //something on success;
  16.   
  17. }  
  18. })  
  1. <div id="loader"style="top:0.5%;right:30%;left:43%;font-size:large; color:#F7F7F7;position:fixed; display:none;">         
  2.                      
  3. <img src="../progress_bar.gif" />  
  4. </div>