回发和回调之间的区别

编程入门 行业动态 更新时间:2024-10-27 09:38:16
本文介绍了回发和回调之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我一直听到这些字词回呼和回传。 两者之间有什么区别?

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)数据。

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) 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:

更多推荐

回发和回调之间的区别

本文发布于:2023-11-25 01:12:16,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:回调   区别

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!