Page 85 - Returning Response Data as a String
I created the CreateXmlHttpRequestObject() function.
I created the following GET statement:
xmlHttpObj.open("GET","http://" + location.host + "/DataFile.xml", true);
Followed by the onreadystatechange function literal:
xmlHttpObj.orreadystatechange = function() {
window.alert(xmlHttpObj.readyState;
if (xmlHttpObj.readyState == 4)
(
document.getElementById("divResults").childNodes(0 ).nodeValue = xmlHttpObj.responseText;
}
xmlHttpObj.send(null);
}
The Window alert brought up the four states:
1 Loading
2 Loaded
3 Interactive
4 Complete
I figured at this point it has located the file (located in c:\ajax\ directory) and that I'm good to go.
The text that got displayed in my div was a bunch of html that had an error of 404 (could not find file).
Why would the states go along fine if it was not locating the file correctly?
Thanks
|