test esame
This commit is contained in:
56
ajax_xml.html
Normal file
56
ajax_xml.html
Normal file
@@ -0,0 +1,56 @@
|
||||
<!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>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user