-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
47 lines (37 loc) · 1.29 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Hello kitty</title>
<script type="text/javascript">
function request(callback) {
var xhr = getXMLHttpRequest();
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && (xhr.status == 200 || xhr.status == 0)) {
callback(xhr.responseXML);
alert('Ok')
}
};
xhr.open("GET", "github.com/AlexandreSi/commando/blob/master/src/chats.xml", true);
xhr.send(null);
}
function readData(oData) {
var nodes = oData.getElementsByTagName("image");
var ol = document.createElement("ol"), li, cn;
for (var i=0, c=nodes.length; i<c; i++) {
li = document.createElement("li");
cn = document.createTextNode(nodes[i].getElementsByTagName("source_url")[0].textContent);
li.appendChild(cn);
ol.appendChild(li);
}
document.getElementById("output").appendChild(ol);
}
</script>
</head>
<body>
<p>
<button onclick="request(readData);">Afficher les chats</button>
<div id="output"></div>
</p>
</body>
</html>