In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what advanced technologies ajax has". In the operation of actual cases, many people will encounter such a dilemma. Then let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
Ajax technology is a technology that requests data from the client to the server, and if you want to actively push the data from the server to the client, you need more advanced data transmission technology. These technologies are mainly used to deal with some real-time data changes on the client display server, and the changes of the data are known only to the server. However, the client needs to display the new data to the page immediately after the server updates the data, which is difficult to do with ajax technology.
What are the ajax technologies?
Short polling
Short polling, also known as traditional polling, is an ancient method. The essence of this method is that the client uses a timer to send ajax requests to the server at regular intervals to send back the latest data from the server. But this method obviously has great disadvantages.
Whether the data is updated or not is determined by the server, so the server should take the initiative to tell the client that I have updated the data after the data on the server has changed, instead of asking the server every time. Because the data update time does not necessarily meet the interval between requests sent by the client, it will cause some meaningless requests to be sent, and the data can not be updated synchronously.
Comet
There are two ways to implement Comet: long polling and streaming.
Long polling
Long polling actually reverses the short polling. The client initiates a request to the server, and the server keeps the connection open until the data update has data to send. After sending the data, the browser closes the connection and then initiates a new request. This process continues during the opening of the page.
Both long polling and short polling browsers send requests to the server before receiving the data. the difference between the two lies in when the server sends requests. The advantage of long polling is that it can reduce useless requests and realize real-time data updates. One of the biggest advantages of polling is that compatibility is very good, all browsers support.
How to do HTTP Stream with ajax Technology
Stream is different from the above two polling because it uses only one HTTP connection throughout the life cycle of the page. A request is sent by the browser, and the server keeps the connection open and then periodically sends data to the browser.
The key of HTTP flow is that all server languages support the function of printing to output and then refreshing. On the client side, you only need to listen for readystatechange events and changes in the value of readyState. As you continue to receive data from the server, the value of readyState will periodically change to 3. When the value of readyState is 3, all the received data will be saved in the responseText attribute. At this time, you need to compare the previous data. To determine the latest data received.
This is the end of the content of "what are the Advanced Technologies in ajax". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.