Monday, 9 February 2015

Hello I need help using AJAX to pull information from my Xml and post into html



I have a assignment that ask for certain information to be pulled from the xml using ajax. So far I have my html, information.xml and below is my code : I also have in the body. My question is how would I pull information from my xml to load onto the html.



function loadinfo() {
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange= readinfo()
xmlhttp.open("GET", "information.xml", true);
xmlhttp.send();
}


function readinfo() {
if (xmlhttp.readyState == 4) {
xmlDoc = xmlhttp.informationXML;

var items = xmlDoc.getElementsByTagName("TechnicalSupport")
root = xmlResponse.documentElement;
grabinfo = root.getElementsByTagName("TechnicalSupport")



}
}


This is my Xml


TechnicalSupport

info online-phone="1-800-588-7885" online-email="TechnicalSupport@html.edu" campus-phone="1-800-588-7886" campus-email="CampusSupport@html.edu"/

TechnicalSupport


No comments:

Post a Comment