jQuery AJAX 与 UpdatePanel

发布于 2024-07-04 10:33:04 字数 142 浏览 6 评论 0原文

我们有一个包含大量 jQuery 的页面(大约 2000 行),我们希望对其进行精简,因为这是维护的噩梦,而且在服务器上维护可能更容易。 我们考虑过使用 UpdatePanel 来实现此目的。 但是,我们不喜欢 UpdatePanel 将整个页面发送回服务器的事实。

We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel is sending the whole page back to the server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

软甜啾 2024-07-11 10:33:04

我不知道是否有办法优化UpdatePanels,但我的公司发现它的性能相当差。 jQuery 做任何事情都快得多。

UpdatePanel 触发更新的时间与 UpdatePanel 实际更新页面的时间之间可能存在很大的滞后。

我们使用 UpdatePanels 的唯一原因是为了易于开发。 几乎不需要做任何事情就能让它们发挥作用。

I don't know if there is a way to optimize UpdatePanels, but my company has found its performance to be pretty poor. jQuery is much much faster at doing pretty much anything.

There can be a lot of lag between the time when an UpdatePanel triggers an update and when the UpdatePanel actually updates the page.

The only reason we use UpdatePanels is because of the ease of development. Almost nothing needs to be done to make them work.

乖乖 2024-07-11 10:33:04

使用 UpdatePanel 会强制您使用在网页中添加大量脚本的 ScriptManager。
UpdatePanel 为您提供部分回发而不是真正的ajax。
如果您仅在 LAN 而不是互联网上运行,那没问题,但如果您的目标是互联网,请尝试重构您的代码并在网站上发布之前使用一些工具压缩它们

Using UpdatePanel force you to use ScriptManager that added tons of scripts in your webpages.
UpdatePanel provides you partial postback and not real ajax.
If your will run only on a LAN and not internet that's ok, but if your target is internet try refractoring your codes and compress them with some tools before publish on the website

苄①跕圉湢 2024-07-11 10:33:04

不要移动到 UpdatePanels。 来自 jQuery 后,性能下降 是站不住脚的。 尤其是在像您的听起来那么复杂的页面上。

如果您有 2,000 行 JavaScript 代码,解决方案是重构该代码。 如果将 2000 行 C# 代码放在一个文件中,维护起来也会很困难。 使用任何语言或工具都很难有效管理。

如果您使用的是 3.5 SP1,则可以使用 ScriptManager 的新脚本组合将 JavaScript 分成多个文件,而不会造成任何损失。 这样,您就可以像处理服务器端代码一样对代码进行逻辑分区。

Don't move to UpdatePanels. After coming from jQuery, the drop in performance would be untenable. Especially on a page as complex as yours sounds.

If you have 2,000 lines of JavaScript code, the solution is to refactor that code. If you put 2,000 lines of C# code in one file, it would be difficult to maintain too. That would be difficult to manage effectively with any language or tool.

If you're using 3.5 SP1, you can use the ScriptManager's new script combining to separate your JavaScript into multiple files with no penalty. That way, you can logically partition your code just as you would with server side code.

甜嗑 2024-07-11 10:33:04

请不要让自己陷入那个痛苦的世界。 而是使用 UFRAME 速度更快,并且是用 jQuery 实现的。

现在,为了管理这 2000 行 Javascript 代码,我建议将代码拆分到不同的文件中,并设置构建过程以使用 JSMin 或 Yahoo Compressor 将它们合并成块。

Please don't put your self in that world of pain. Instead use UFRAME which is a lot faster and is implemented in jQuery.

Now, to manage those 2000 lines of Javascript code I recommend splitting the code in different files and set up your build process to join them using JSMin or Yahoo Compressor into chunks.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文