ashkufaraz
ashkufaraz

Reputation: 5297

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()

Upvotes: 1

Views: 5999

Answers (3)

ashkufaraz
ashkufaraz

Reputation: 5297

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

Upvotes: 2

John Archer
John Archer

Reputation: 2495

This seems to be the same problem as this: blockUI vs ajax with async option to false (possible duplicate!).

You have to set async to true and all the code that you want to execute after you ajax call has to be called inside "success", e.g.

Upvotes: 0

JasCav
JasCav

Reputation: 34632

Do you have the **'s in your actual code? If so, that's why the calls aren't working.

Upvotes: 0

Related Questions