blockUI works but unBlockUI Isn't

RubbleFord picture RubbleFord · Sep 18, 2009 · Viewed 9.2k times · Source

I've implemented block UI as this request can take a little, time when the ajax request starts everything works as expected.

But when the ajax request finishes and the msgbox is shown, the UI doesn't unblock!

Any ideas?

I'm using IE8.

$().ajaxStart($.blockUI); 
$().ajaxStop($.unblockUI); 

function ChangeCompanyState(companyId, state) {
    var parameters = "{companyId:" + companyId + ",state:\"" + state + "\"}";
    $.ajax({
        type: "POST",
        url: "Ajax/AjaxFragments.aspx/ChangeCompanyState",
        data: parameters,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            if (msg.d.length > 1) {
                alert(msg.d);
                $.unblockUI();
            }
            else {
                //Theres no message to process success.
                window.location.reload();
            }
        }

    });
}

Answer

Michael Offengenden picture Michael Offengenden · Nov 2, 2009
$.unblockUI();
$(".blockUI").fadeOut("slow");