Home  >  Article  >  Backend Development  >  Detailed explanation of XML HTTP requests

Detailed explanation of XML HTTP requests

黄舟
黄舟Original
2017-03-28 17:21:122682browse

If you use IE5.0 or higher version browser, you can obtain XML data from the server through HTTP request.

-------------------------------------------------- ------------------------------------

Browser request
By browsing The server can send HTTP requests and obtain XML data from the server:

var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
objHTTP.Open('GET','httprequest.asp',false)
objHTTP.Send()

The following code displays the return data from the server in the browser:

document.all['A1'].innerText= objHTTP.status
document.all['A2'].innerText= objHTTP.statusText
document.all['A3'].innerText= objHTTP.responseText

------ -------------------------------------------------- --------------------------

Interaction with the server
You can "interact" with the server through HTTP requests .

Using XML to interact with the server

We "fabricated" the following ASP code on the server side to interact with:

<%
response.ContentType="text/xml"
txt="<answer><text>12 Years</text></answer>"
response.write(txt)
%>

So no matter what you ask, the answer is always It's 12 years. In real life, you have to write a lot of code to analyze the problem and respond to the correct answer.

The above is the detailed content of Detailed explanation of XML HTTP requests. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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