It new technology terminology: Ajax and soap--asynchronous data and XML acquisition

Source: Internet
Author: User
Tags object end soap return window
ajax|xml| Data | asynchronous

It new technology terminology: Ajax and soap--asynchronous data and XML acquisition

AJAX: The original asynchronous JavaScript and XML applications, which is actually the number of XML that can be asynchronously obtained via JavaScript

According to the application!

I think this abbreviation is the most narrow, because I can completely convert JS to a VBS, then it can be abbreviated as Avax?!

At this point, far less than soap, it should be the original text of simple Object access Protocol, the simplicity of accessing protocol (Khan, I Also

I can't confirm it. In fact, the object and technology used is XMLHTTP. It is much more standard and broader, referring to all the client script to vary

Steps to get the application of XML data, naturally including JS, VBS or other scripts.

Give a small example:

<script type= "Text/javascript" >
<!--
function Ajaxread (file) {
var xmlobj = null;
if (window. XMLHttpRequest) {//If the browser supports Windows directly. XMLHttpRequest objects
Xmlobj = new XMLHttpRequest ();
if (xmlobj.overridemimetype) {xmlobj.overridemimetype (' text/xml ');} Prevent some versions of Mozilla

? g? [The device is sent back to the server?] Y material contains no XML mime-type?n?^ (header)? R out E
 } else if (window. ActiveXObject) {//If the browser supports Windows. ActiveXObject Object
    try {
        xmlobj = new ActiveXObject ("Msxml2.xmlhttp");
   } catch (e) {
        try {
             xmlobj = new ActiveXObject ("Microsoft.XMLHTTP");
       } catch (e) {}
   }
 } else {
       return; The browser doesn't support anything, and I have nothing to do with it: P
 }
  if (!xmlobj) {
 alert (' Giving up:( Cannot create an XMLHTTP instance ');
 return;
 }

Xmlobj.onreadystatechange = function () {//This event is triggered when the Xmlobj state changes in asynchronous execution mode
if (xmlobj.readystate = = 4) {
if (Xmlobj.status = =) {//http status code, no error. Refer to. statustext
document.getElementById (' Xmlobj '). Firstchild.data =

XmlObj.responseXML.getElementsByTagName (' data ') [0].firstchild.data; document.getElementById

(' Xmlobj '). Firstchild.data can also be replaced by. InnerHTML
} else {
Alert (' There is a problem with the request. ');
Return
}
}
}

Xmlobj.open (' Get ', file, true); Open Connection: Request method, filename (based on security considerations, you can not call the same?) W field to

Outside of? W??. But you should be able to let go of Internet options in IE, asynchronous/synchronous
Xmlobj.setrequestheader (' Content-type ', ' application/x-www-form-urlencoded '); If. Open to post

Way to open
Xmlobj.send ("); This directive must be executed, otherwise the state of the XMLHttpRequest object will not change to 4!
}
-->
</script>

Note:
The state of the XMLHttpRequest object has a total of five states, from 0 to 4.
0– not initialized (before this xmlhttprequest starts)
A/XMLHttpRequest load (end of initialization)
2– Load End (XMLHttpRequest a response from the server)
3– interaction (When XMLHttpRequest objects and server connections)
4– ends (when XMLHttpRequest is told that it has completed all the characters and ends the run)

IE5 above Support ~ ~
In addition to XMLHTTP objects, CSS and DOM techniques are involved.

Advantage:
Eliminates the need to refresh the entire page for each interaction with the server.
Faster interaction with the server, part of the page is always more than required to return the entire page of the number of small traffic.


Mountain Wind (lanyd) message:
In fact, not necessarily to XMLHTTP, do not say TXT file can not be accessed by HTTP to the asynchronous? If someone has provided a XMLHTTP work

Can txthttp object, we can achieve (just had no one had this idea before). In fact, the current XMLHTTP has supported

TXT, you can get it with xmlhttp.repsponetext. Only, XML is more uniform and standard than TXT description, or the sentence, TXT can be finished

Fully customizable, XML is more versatile:



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.