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 is the XMLHTTPRequest object in AJax

2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly shows you "what is the XMLHTTPRequest object in AJax", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the XMLHTTPRequest object in AJax" this article.

1. What is XMLHttpRequest

Definition: XMLHttp is a set of API that can transmit or receive XML and other data through http protocol in Javascript, VbScript, Jscript and other scripting languages. The greatest use of XmlHttp is that it can update parts of a web page without having to refresh the entire page (this is one of the biggest features of AJax).

2. Create a XMLHttpRequest object

Before we can use the XMLHTTPRequest object to send the request and process the response, we must create a XMLHTTPRequest object with javascript. IE implements XMLHTTPRequest as an ActiveX object, while other browsers [such as Firefox/Safari/Opear] implement it as a native javascript object. Please look at the following example

The copy code is as follows:

Var xmlhttp

/ / create a XMLHTTPRequest object

Function createXMLHTTPRequest () {

If (window.ActiveXObject) {/ / determine whether the ActiveX control is supported

Xmlhttp = new ActiveObject ("Microsoft.XMLHTTP"); / / creation method supported by IE browser

}

Else if (window.XMLHTTPRequest) {/ / determines whether to implement XMLHTTPRequest as a local javascript object

Xmlhttp = new XMLHTTPRequest (); / / creation methods supported by browsers such as FireFox,Opera

}

}

3. Attributes and methods

Because there is a lot of content involved, and I am also learning, so I also learn with reference to other people's examples, so paste other people's good things up here for review.

The copy code is as follows:

Description DEMO of the XMLHTTPRequest object

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