Home > Web Front-end > JS Tutorial > Introduction to the properties and methods of XMLHTTPRequest_javascript skills

Introduction to the properties and methods of XMLHTTPRequest_javascript skills

WBOY
Release: 2016-05-16 18:15:26
Original
1015 people have browsed it

An important technology (tool) used when designing AJAX is the XMLHTTPRequest object. Here Tsunami will share with you some of my information on learning the XMLHTTPRequest object. The information in this article was collected online by Tsunami when he was studying. If you have driven it, let’s deepen your impression! (If you feel that your copyright has been infringed, please contact tsunami. (haixiao_yao[at]yahoo.com.cn))
1. What is the XMLHTTPRequest object?
The most common definition is: XmlHttp is a set of APIs that can transmit or receive XML and other data through the http protocol in JavaScript, VbScript, Jscript and other scripting languages. The biggest use of XmlHttp is that it can update part of the content of a web page without refreshing the entire page. (This function is one of the major features of AJAX:))
Explanation from MSDN: XmlHttp provides a protocol for the client to communicate with the http server. The client can send a request to the http server through the XmlHttp object (MSXML2.XMLHTTP.3.0) and use the Microsoft XML Document Object Model Microsoft? XML Document Object Model (DOM) to process the response.
Let me digress here. In fact, this thing has appeared a long time ago, but the browser support was not enough in the past. It was only supported in IE, so most WEB programmers did not use it very much, but now the situation has happened. Big changes, Mozilla and Safari adopted it as a de facto standard, and mainstream browsers began to support the XMLHTTPRequest object. But what needs to be emphasized here is that XMLHTTPRequest is not yet a W3C standard, so the performance on different browsers is slightly different.
2. Create an XMLHTTPRequest object
By the way, speaking of differences, let’s take a look at how to declare (use) it. Before using the XMLHTTPRequest object to send requests and process responses, we must To create an XMLHTTPRequest object using javascript. (IE implements XMLHTTPRequest as an ActiveX object, and other browsers [such as Firefox/Safari/Opear] implement it as a native javascript object). Let’s take a look at how to use javascript to create it:

Copy the code The code is as follows:




3. Attributes and methods. Since there are too many things, I will use a page to list the methods and attributes. I will give detailed examples later (mainly because I am also learning).
Copy code The code is as follows:



Description of XMLHTTPRequest objectDEMO








Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template