当前位置: 动力学知识库 > 问答 > 编程问答 >

Please Wait dialog after clicking on submit button in ASP.NET MVC 5

问题描述:

There are a few ASP.NET MVC modal dialog questions on S/O but they are either "page-loading, please-wait" or confirmation modal dialogs (you click on a submit button, and before processing proceeds, you click on an OK or Cancel button in the dialog). My requirement is for a please-wait modal dialog to be displayed after clicking on a submit button, which grays out the web page (i.e., a modal dialog), displaying only a spinning wheel gif and waiting until some long-running (not a huge amount of time, just 10-15 seconds max) server-side code completes. (Right now in our application users sometimes get impatient and start spuriously clicking on the submit button again regardless of the fact that the browser window wait spinner thingamajig is still spinning.) When the server-side code completes, the please-wait dialog should go away.

Is there a relatively easy/straightforward way to do this using ASP.NET MVC / javascript / jquery? Anyone done this specific thing already that would be nice enough to share?

Note that I found one reference that I think I might be able to use some of the code from:

https://pure-essence.net/2010/01/29/jqueryui-dialog-as-loading-screen-replace-blockui/

As you can see, that article is for the "page-loading, please-wait" use case. But the first part of the code, that displays the please-wait dialog I think I could use. IOW, user clicks on the submit button and I use the code in the article on the client-side to display the modal please-wait dialog. The request goes ahead to the server and the controller action method executes. When the server-side code completes, I simply display the view I want (same view in which a div underneath the submit button says "your request has completed" or a different, request complete view - either one) which effectively makes the please-wait dialog go away. Does that make sense to y'all?

分享给朋友:
您可能感兴趣的文章:
随机阅读: