Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the differences between http and ajax

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Most people do not understand the knowledge points of this article "what are the differences between http and ajax", so the editor summarizes the following content, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "what is the difference between http and ajax" article.

Differences: 1, AJAX requests the server through the xmlHttpRequest object, while the http request requests the server through the httpRequest object; 2, the AJAX request header will have an extra "x-requested-with" parameter with a value of "XMLHttpRequest".

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

The difference between AJAX request and ordinary HTTP request

AJAX implements refresh interaction by requesting the server to accept the request return data through the xmlHttpRequest object.

An ordinary http request requests the server to accept the request to return data through the httpRequest object, which requires page refresh

The AJAX request header will have an extra x-requested-with parameter with a value of XMLHttpRequest

AJAX request

Normal http request

The AJAX request header will have an extra x-requested-with parameter with a value of XMLHttpRequest

String requestType = request.getHeader ("X-Requested-With")

Take this as the basis for judgment.

Expand knowledge:

What is Ajax:

Ajax (Asynchronous Javascrpt And Xml) is a technology used in browsers, which allows the browser to obtain a small amount of information from the server instead of refreshing the entire page by using an asynchronous communication mechanism between the browser and the server. Ajax is not a new technology, or it is not a technology, it is just a synthesis of a variety of technologies: Javascript, Html, Css, Dom, Xml, XMLHttpRequest and other technologies play their respective roles in cooperation in a certain way to form Ajax.

XMLHttpRequest is a core of Ajax technology, and Ajax can't operate without it.

XMLHttpRequest:XMLHttpRequest is an object of XMLHttp component, and XMLHttpRequest can be used to realize asynchronous communication between browser and server. Through the HttpRequest object, the Web application can submit information to the server without refreshing the page, and then get the return information from the server.

Let's talk about Ajax and websocket, http.

In fact, these three have their own advantages and disadvantages. The emergence of websocket and ajax solves some problems of http protocol, but http still has advantages in many places. Ajax is one-way (client-server), http is also one-way initiated by client, websocket implements two-way, but they each have their own suitable use scenarios.

The above is about the content of this article on "what is the difference between http and ajax". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report