Ajax 可以在浏览器上返回信息,而无需刷新。这是否意味着它将 ID 存储在 session /有状态行为中?我没有看到基于 Ajax 的 Web 应用程序中的 URL 发生任何变化。我正在查看的示例是 - http://evolvingweb.github.io/ajax-solr/examples/reuters/index.html 。我正在尝试比较在 ASP.NET MVC 中开发的无状态 UI 与在 javascript 框架中使用 ajax 开发的 UI
最佳答案
HTTP 是一种无状态协议(protocol)。来自 Http RFC :
The Hypertext Transfer Protocol (HTTP) is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol which can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of its request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred.
Ajax 并不像您想象的那样: 来自 W3C :
AJAX = Asynchronous JavaScript and XML.
AJAX is a technique for creating fast and dynamic web pages.
AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.
Classic web pages, (which do not use AJAX) must reload the entire page if the content should change.
ASP.NET State Management可以使用 Cookie、 session 、Browser Cache 来完成(HTML5 提供浏览器数据库用于缓存)、Profile、SQL Server 缓存、QueryStrings、HiddenFields。
构建响应用户的 Web 应用程序是一种新趋势,SPA (单页应用程序)使用在 JavaScript 中构建的 Ajax 和 MVVM 框架提供出色的用户体验。
关于javascript - ajax 可以使 Web 应用程序有状态吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17837174/