topical media & game development
#javascript-code-07-response.js / js
// Create the request object
var xml = new XMLHttpRequest();
// Open the asynchronous POST request
xml.open("GET", "/some/url.cgi", true);
// Watch for when the state of the document gets updated
xml.onreadystatechange = function(){
// Wait until the data is fully loaded
if ( xml.readyState == 4 ) {
// xml.responseXML contains the XML Document (if one was returned)
// xml.responseText contains the response text (if no XML document was provided)
// Clean up after ourselves, to avoid memory leaks
xml = null;
}
};
// Establish the connection to the server
xml.send();
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.