Please visit our sponsors !
XML HTTP Requests
If you are using IE 5.0 or higher, XML data can be requested from a server using an HTTP request.
The Browser Request
An HTTP request from the browser, can request XML from a server:
var objHTTP = new ActiveXObject("Microsoft.XMLHTTP")
objHTTP.Open('GET','httprequest.asp',false)
objHTTP.Send()
|
To view the result from the request, you can display the result in your
browser:
document.all['A1'].innerText= objHTTP.status
document.all['A2'].innerText= objHTTP.statusText
document.all['A3'].innerText= objHTTP.responseText
|
Try
it Yourself using JavaScript
Try
it Yourself using VBScript
Communicating with the Server
With HTTP requests you can "communicate" with a server.
Communicating with a server using XML
In the example the response is "faked" on the server with this ASP code:
<%
response.ContentType="text/xml"
txt="<answer><text>12 Years</text></answer>"
response.write(txt)
%>
|
So, the answer will always be 12 years, no matter what question is asked. In
real life, you have to write some code to analyze the question and respond with
a correct answer.
Jump to: Top of Page
or HOME or
Printer friendly page
Search W3Schools:
What Others Say About Us
Does the world know about us? Check out these places:
Dogpile
Alta Vista
MSN
Google
Excite
Lycos
Yahoo
Ask Jeeves
We Help You For Free. You Can Help Us!
W3Schools is for training only. We do not warrant its correctness or its fitness for use.
The risk of using it remains entirely with the user. While using this site, you agree to have read and accepted our
terms of use and
privacy policy.
Copyright 1999-2002 by Refsnes Data. All Rights Reserved
|