Using Asp.Net MVC 3 (Razor). I'm trying to add the blockUI plug in to show loading indicator when calling actions with @Ajax.ActionLink
It works fine if I use the default call of
$(document).ajaxStart($.blockUI);
But when I try to customize the message using the following, the UI is blocked as soon as the page loads. Can someone advise the correct format?
$(document).ajaxStart($.blockUI({
message: '<h1><img src="busy.gif" /> Just a moment...</h1>'
}));
In the second piece of code, you are actually executing the blockUI method.
Wrap it in an anonymous function:
$(document).ajaxStart(function() {
$.blockUI({
message: '<h1><img src="busy.gif" /> Just a moment...</h1>'
});
});
Working example on jsfiddle