Files
unisa_tsw_2014_2015/ajax_xml.html
2015-01-17 03:44:06 +01:00

57 lines
820 B
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Titolo</title>
<meta name="" content=""/>
</head>
<body>
<span> reading xml with ajax</span>
<span id="content"></span>
<script>
var request = new XMLHttpRequest();
request.addEventListener("load",loadfunction,false);
request.open("GET","xml.php");
request.send();
function loadfunction(){
var content = document.getElementById("content");
if (content){
var data = request.responseXML;
var c = data.documentElement.children;
for (i=0;i< c.length;i++){
content.innerHTML+= c[i].childNodes[0].nodeValue;
}
}
}
</script>
</body>
</html>