views:

255

answers:

0

I have been using jQuery with ASP.NET MVC and the plug-in jQuery blockUI with success when using jQuery to make ajax calls to get data. I also have situations where I am just using plain ASP.NET MVC and where the postback to the server once the user clicks the submit button makes a database call that takes a long time. So I decided to try to use jQuery to attach to the submit button click handler to call blockUI. This almost works, the only issue is that in the blockUI call I want to include a busy spinning image.

$('div.block').block({ 
    message: '<h1><img src="/content/images/busy.gif" /> Please wait while the request is being processed...</h1>',
    overlayCSS: { backgroundColor: '#aaaaaa', opacity: 0.4 }
});

In this case the spinner doesn't spin.

The easy work around is just to make the asynchronous callback to the server from within the jQuery click handler and everything will work fine. But my question is why do I need to do this since the block call otherwise works as expected?