Using the BlockUI JQuery plugin I find strange behaviour from within an ASP.Net page.
I've implemented one of the BlockUI plugin demos (you can try out the original here - http://malsup.com/jquery/block/#dialog ) within an ASP.Net page.
When I serve this page from Visual Studio (MVWD 2010 Express) the 'Would you like to continue' dialog appears as it should but then (rather than waiting for me to press a button) just disappears after 1 to 2 seconds.
Can anyone explain why this might be ? The HTML rendered by the ASP.Net is visible at http://pastie.org/1057741 (lines 139-165 are the main bit).开发者_开发知识库
Would appreciate any suggestions.
Well thanks to the folks on the 'Using JQuery plugins' forum (http://forum.jquery.com/using-jquery-plugins) this has been resolved.
The 'type' attribute of the input element with value 'Show Dialog' was 'Submit' which was causing a postback.
<input id="test" type="submit" value="Show Dialog" />
There were two ways to fix this:
- Change 'type' to 'button' or ...
- Put 'return false' within the two JS functions
FWIW I also amended my original example code (shown at http://pastie.org/1057741) to deal with the ajax call to the non-existent (in my environment) resource 'wait.php'. The resulting code block is visible at : http://pastie.org/1061480 .
精彩评论