Detailed explanation of XML HTTP requests

黄舟
Release: 2017-03-28 17:21:12
Original
2664 people have browsed it

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()
Copy after login

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
Copy after login

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

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)
%>
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!