什么是jQuery的阿贾克斯VS UpdatePanel的优点 [英] What are the advantages of jQuery Ajax vs UpdatePanel

查看:96
本文介绍了什么是jQuery的阿贾克斯VS UpdatePanel的优点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到了几个类似的问题在这里StackOverflow上,但他们用以下标准来概括。

I saw couple of similar question here on StackOverFlow but none of them to summarize with the following criteria.

什么是jquery.ajax VS的UpdatePanel的优势(如 - 视图状态,速度,大小)

What are the advantages of jquery.ajax vs UpdatePanel (like - viewstate, speed, size)?

推荐答案

IMO,比较jQuery的AJAX更新面板是一个有点像比较苹果VS桔子。

IMO, comparing jquery ajax to update panel is a bit like comparing apples vs oranges.

的UpdatePanel是非常容易使用;你真的没有写任何显著code实现AJAX,服务器控件模型无缝工作。这通过发出异步POST请求实现 - 因此,所有的表单元素得到公布,包括视图状态。在服务器端,整个控件树被加载和页面遵循正常的生命周期,直到呈现在从更新面板只有HTML是(连同视图状态)发送到客户端。所以,你有大尺寸的要求,更多的服务器负载和大尺寸的反应。

UpdatePanel is very easy to use; you really don't have to write any significant code to achieve AJAX, works seamlessly with server controls model. This is achieved by issuing asynchronous post request - so all form elements get posted including view-state. On server side, entire control tree gets loaded and page follows normal life cycle till rendering at which only html from update panel is sent (along with view-state) to client side. So you have large request size, more server load and large response size.

另一种方法是,使异步调用服务器,其中要求将携带只需要对服务器的呼叫数据。服务器将与所需的数据作出反应。通常情况下,人们会使用JSON将数据从服务器传输到/,减少请求和响应的大小。在服务器端,典型地,一个脚本服务或页面方法用于将执行特定任务(与以下一个页面生命周期)减少服务器的负载。

Alternative is to make async server calls, where request would carry only data that is needed for server call. The server would respond with the data needed. Typically, one would use JSON to transfer data to/from server, reducing request and response size. On server side, typically, a script service or page method is used which will do the specific task (as opposed to following a page life cycle) reducing server load.

现在,脚本服务/页的方法可以是通过使用产生的ScriptManager代理或使用jQuery AJAX调用。我preFER jQuery来避免ASP.NET AJAX生成的代理code尺寸较大。

Now, script services/page methods can be either invoked using proxies generated by ScriptManager or using jquery AJAX. I prefer jquery to avoid the larger size of proxy code generated by ASP.NET AJAX.

这篇关于什么是jQuery的阿贾克斯VS UpdatePanel的优点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆