Javascript load a xml file
into memory and create an object for accessing
var myXmlDoc = new ActiveXObject("Microsoft.XMLDOM");
myXmlDoc.async = false;
myXmlDoc.load("exampleDoc.xml");
// access elements
myXmlDoc.childNotes(0).childNodes(1).tagName;
myXmlDoc.childNotes(0).getAttribute("raceNo");
myXmlDoc.childNotes(0).childNotes(1).text;
var myRequest = getXmlHttpRequest();
myRequest.open("GET", url, true);
myRequest.onreadystatechange = callbackFunc;
myRequest.send(null);
readystate:
1- unitialized
2 - loading
3 - interactive
4 - completed
if(myRequest.readyState == 4)
{
if(myRequestStatus == 200)
{
var greetNode = http.responseXml.getElementByTagName("greeting")[0];
var greetText = greetNode.childNodes[0].nodeValue;
}
}
** here http should be myRequest?!
using the returned data
document.getElementById() ...
No comments:
Post a Comment