ashkufaraz ashkufaraz - 4 months ago 30
jQuery Question

blockui() and unblockUi() in ajax

$.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; ;


this code run success but Does not work blockui() and unblockui()

Answer
$(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();