Server Response
To obtain a response from the server, use the responsetext or responsexml attribute of the XMLHTTPRequest object.
Attribute
Description
Responsetext
Obtain response data in string format.
Responsexml
Obtain response data in XML format.
Responsetext attributes
If the response from the server is not XML, use the responsetext attribute.
The responsetext property returns a string-type response, so you can use:
Document. getelementbyid ("mydiv"). innerhtml = XMLHTTP. responsetext;
Responsexml attributes
If the response from the server is XML and needs to be parsed as an XML object, use the responsexml attribute:
Request the books. xml file and parse the response:
Xmldoc = XMLHTTP. responsexml; TXT = ""; X = xmldoc. getelementsbytagname ("artist"); for (I = 0; I <X. length; I ++) {TXT = TXT + X [I]. childnodes [0]. nodevalue + "<br/>";} document. getelementbyid ("mydiv "). innerhtml = txt;