-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathjson.xhtml
More file actions
31 lines (31 loc) · 762 Bytes
/
json.xhtml
File metadata and controls
31 lines (31 loc) · 762 Bytes
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>sample</title>
<script>
function success(resp) {
var res;
try {
res = JSON.parse(resp);
} catch (error) {
return;
}
document.getElementById('greeting').appendChild
(document.createTextNode(res.greeting));
}
document.addEventListener('DOMContentLoaded', function() {
var xmh = new XMLHttpRequest();
xmh.onreadystatechange = function() {
if (xmh.readyState === 4 && xmh.status === 200)
success(xmh.responseText);
};
xmh.open('GET', '/cgi-bin/app/index.json', true);
xmh.send(null);
});
</script>
</head>
<body>
<span id="greeting"></span>
</body>
</html>