"请等待"消息使用jQuery或AJAX?消息、请等待、QUOT、jQuery

2023-09-07 13:52:39 作者:情深似海

我创建一个企业网站模板,可以用于所有的web应用程序的开发。我们的许多现有的应用程序需要一段时间来加载,因为数据和数据源的地理距离量,所以用户经常点击相同的按钮和链接的两倍。

I am creating an enterprise web template to be used for development of all our web applications. Many of our existing applications take a while to load because of the amount of data and geographic distance of the data source, so users frequently click the same buttons and links twice.

我打算添加一个请等待消息拿出当页面回发。我想有两个明显的方式做到这一点:

I plan to add a Please Wait message to come up when the page is posting back. I figured there are two obvious ways to do this:

1。 AJAX工具

使用AJAX 的UpdatePanel 和进步装载机,我可以轻松地显示在每次回发的消息很少,如果有的话,额外的code。

Using the AJAX UpdatePanel and progress loader, I can easily show a message on each postback with very little, if any, additional code.

我用AJAX方法值得关注的是,因为这是非常通用的模板,我会包装在一个更新面板整个页面。从与ASP.NET 3.5 AjaxToolKit经验,更新面板影响到时髦的方式回传和JavaScript code。另外,我觉得的UpdatePanel重且增加加载会话或应用程序所需要的时间量

My concern with the AJAX method is that, because this is very generic template, I would have to wrap the whole page in an update panel. From experience with the ASP.NET 3.5 AjaxToolKit, the update panel affects postbacks and JavaScript code in funky ways. Also, I think UpdatePanels are heavy and increase the amount of time needed to load the session or application.

2。 jQuery的

使用jQuery,我可以绑定一个方法,显示消息给每个 $(':提交)点击(){} 事件。该页面将重新加载在文章后面的端自动隐藏的消息。

Using jQuery, I can bind a method that shows the message to each $(':submit').click() {} event. The page would automatically hide the message by reloading at the end of the post back.

我没有用jQuery的方法主要关注的问题。这将需要额外的编码与现场校验正常工作。不使用的UpdatePanel 也意味着整个页面重新加载在每次回发,这可能不是最好的方法。它也将不得不被延迟了几秒钟才出现的请等待消息,使其不会出现非常小的事件并不需要这样的消息。

I don't have major concerns with the jQuery method. It would require extra coding to work correctly with field validators. Not using the UpdatePanel also means the whole page is reloaded on every postback, which might not be the best method. It would also have to be delayed a few seconds before the 'Please Wait' message appears so that it doesn't appear for very small events that do not need such a message.

这是更好的方式来显示一个请等待或加载的消息?我关心的是速度和可靠性,但如果有成功的,你觉得是值得关注的其他措施,随意说出来。

Which is the better way to show a Please Wait or Loading message? I am concerned with speed and reliability, but if there are other measures of success that you feel are noteworthy, feel free to say so.

推荐答案

绝对#2。添加的UpdatePanel 是蠕虫的一个整体,如果你不使用他们已经给定的网页上,增加了大量的开销。

Definitely #2. Adding an UpdatePanel is a whole can of worms, and if you're not using them already on a given page, adds a lot of overhead.

涉及使用jQuery做,这是微不足道的code。有一个可爱的小插件叫做 blockui ,可以用来对一个区域呈现的效果,并禁用所有控件。这不是太难做到这一点不用的插件使用,但为什么重塑?

The code involved in using jQuery to do this is trivial. There's a nice little plugin called blockui that can be used to render an effect and disable all controls on an area. It's not too hard to do this without the plugin either, but why reinvent?