Advertisement
Guest User

Untitled

a guest
Feb 6th, 2019
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getXML(){
  2. var xhttp;
  3. xhttp = new XMLHttpRequest();
  4. xhttp.onreadystatechange = function() {
  5.     if (this.readyState == 4 && this.status == 200) {
  6.         myFunction(this);
  7.     }
  8. };
  9. xhttp.open("GET", "asthma.xml", true);
  10. xhttp.send();
  11.  
  12. function myFunction(xml) {
  13.     var x, i, txt, xmlDoc;
  14.     xmlDoc = xml.responseXML;
  15.     txt = "";
  16.     x = xmlDoc.getElementsByTagName("title");
  17.     for (i = 0; i < x.length; i++) {
  18.         txt += "<td>" + x[i].childNodes[0].nodeValue+"</td>";
  19.     }
  20.     document.getElementById("orgChartData").innerHTML =txt +"</tr></table></div>";
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement