回发和回调之间的区别 [英] Difference between a Postback and a Callback

查看:279
本文介绍了回发和回调之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直听到这些字词回呼回传

两者之间有什么区别?

I keep on hearing this words 'callback' and 'postback' tossed around.
What is the difference between two ?

Postback是否特定于ASP.NET页面?

Is postback very specific to the ASP.NET pages ?

推荐答案

当页面上的数据(整个页面)从客户端发布到服务器时发生回发,数据回发到服务器,因此页面被刷新重新绘制)...将其视为向服务器发送整个页面(asp.net)数据

A Postback occurs when the data (the whole page) on the page is posted from the client to the server..ie the data is posted-back to the server, and thus the page is refreshed (redrawn)...think of it as 'sending the server the whole page (asp.net) full of data'.

另一方面,回调也是一种特殊类型的回发,但它只是一个快速往返服务器获取一小组数据(通常),因此该页面不会刷新,不同于回发...将其视为调用服务器,并接收一些数据

On the other hand, a callback is also a special kind of postback, but it is just a quick round-trip to the server to get a small set of data (normally), and thus the page is not refreshed, unlike with the postback...think of it as 'calling the server, and receiving some data back'.

使用Asp.Net,当调用回调时ViewState不会刷新,与回发不同。

With Asp.Net, the ViewState is not refreshed when a callback is invoked, unlike with a postback.

ASP.NET发布的整个页面是因为ASP.Net使用 post方法将整个页面包含在< form> 当在页面中点击提交按钮时,表单被发送到服务器,其中所有的字段都是基本上整个页面本身。

The reason that the whole page is posted with ASP.Net is because ASP.Net encloses the whole page in a <form> with a post method, and so when a submit button is clicked in the page, the form is sent to the server with all of the fields that are in the form... basically the whole page itself.

如果您使用的是FireBug (Firefox),您实际上可以在控制台中看到回调被调用到服务器。这样,您将看到发送到服务器的特定数据请求)以及服务器发回您的数据( Response )。

If you are using FireBug (for Firefox), you can actually see callbacks being invoked to the server in the Console. That way, you will see what specific data is being sent to the server (Request) and also the data the server sent you back (Response).

下图显示了两个页面的页面生命周期基于ASP.NET的网站中的回发和回调:

The below image illustrates the Page Life Cycles of both a postback and a callback in a ASP.NET based Website:

这篇关于回发和回调之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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