-
Notifications
You must be signed in to change notification settings - Fork 8
/
populate.js
38 lines (30 loc) · 1.06 KB
/
populate.js
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
function populate() {
$.getJSON('status?' + Math.floor(Math.random()*30000), function (data) {
var x = "";
for (var category in data.alive) {
x += "<div class=\"row align-row\">";
x += "<h4>" + category + "</h4>";
for (var entry in data.alive[category]) {
x += "<span class=\"btn btn-success btn-override\">" +
entry + "<em>" + data['alive'][category][entry] + "</em></span>";
}
x += "</div>"
}
$('#alive-data').html(x);
var x = "";
for (var category in data.dead) {
x += "<div class=\"row align-row\">";
x += "<h4>" + category + "</h4>";
for (var entry in data.dead[category]) {
x += "<span class=\"btn btn-danger btn-override\">" +
data.dead[category][entry] + "</span>";
}
x += "</div>"
}
$('#dead-data').html(x);
});
}
$(document).ready(function () {
window.setInterval(populate, 3000);
populate();
});