开发者

JQuery plugin - BlockUI - works strangely from Visual Studio?

开发者 https://www.devze.com 2023-01-09 04:05 出处:网络
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/b

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:

  1. Change 'type' to 'button' or ...
  2. 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 .

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号