2011-03-14 20 views
0
$.blockUI(); 
    email = $("#txtregistEmail").val(); 
    chaptch = $("#txtregistcaptcha").val(); 

    var result = ""; 
    result = $.ajax({ url: "AllCommand.aspx?cmd=InsertMember&txtregistEmail=" + email + "&txtregistcaptcha=" + chaptch , 
     async: false, 
     complete: function() { 
      // unblock when remote call returns 
      $.unblockUI(); 
     } 
    }).responseText; ; 

此代碼運行成功,但不工作blockui()和unblockui()blockui()和unblockUi()在阿賈克斯

回答

1
$(document) 
    .ajaxStart(function() { 
     $.blockUI({ 
      message: '<b><img src="/images/IconLoading.gif" /> در حال انجام عملیات...</b>', 
      css: { 
       border: 'none', 
       padding: '15px', 
       backgroundColor: '#000', 
       '-webkit-border-radius': '10px', 
       '-moz-border-radius': '10px', 
       opacity: .5, 
       color: '#fff', 
       width: '200px' 
      } 
     }); 
    }) 
    .ajaxStop(function() { 
     $.unblockUI(); 
0

你有**的在您的實際代碼?如果是這樣,那就是通話不起作用的原因。

0

這似乎是與此相同的問題:blockUI vs ajax with async option to false(可能重複!)。

您必須將async設置爲true,並且在ajax調用之後要執行的所有代碼必須在「success」中調用,例如,