views:

481

answers:

1

hi, i am using jQuery BlockUI Plugin (v2) to block and unblock while loading and when on clicking some button.but my problem is masking is working fine while loading page but it is not working when we click button,here is my code

$("input[name^=filtera]").click(function(){
 $.blockUI({message:'<h3><img src="images/spinner.gif" /> Please Wait...</h3>'});
 $.ajax({
    url : "ChangeRequestSearch.action?last_date_modified=" + modifiedDate ,
    cache: false,
    success : function (data) {
      $("#tableLoader").html(data);
    }
 });
 $().ajaxStop($.unblockUI); 
});

i am getting the Error: $.blockUI is not a function

let me know what is the problem

Thanks Usman.sk

+1  A: 

You can rearrange the code a bit here to call it using $.ajaxStart() to go with your $.ajaxStop() like this:

$(document).ajaxStart(function() {
 $.blockUI({message:'<h3><img src="images/spinner.gif" /> Please Wait...</h3>'});
}).ajaxStop(function() {
 $.unblockUI();
});

Note that in jQuery 1.4+ you should use $(document) instead of $() for these bindings, since $() no longer returns the document wrapped in a jQuery object.

Nick Craver