summaryrefslogtreecommitdiff
path: root/modules/up_log/index.html
blob: d8371d9c91e70a3b56d4ba62ddc4958196b659f3 (plain)
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Uplog</title>
<style>
#log {
  border: 1px gray solid;
}
</style>
<script>
function get() {
  var xhr = new XMLHttpRequest();
  xhr.open("GET", location.href + "/log/" + document.getElementById("count").value);
  xhr.responseType = "text";
  xhr.onreadystatechange = function() {
    if (xhr.readyState == 4) {
      if (xhr.status == 200) {
        document.getElementById("log").innerHTML = "";
        document.getElementById("log").appendChild(document.createTextNode(xhr.responseText));
      } else {
        alert(xhr.responseText);
      }
    }
  };
  xhr.send();
}
</script>
</head>
<body>
Count: <input type="number" id="count" value="100" min="1" onchange="get()">
<input type="button" onclick="get()" value="Get">
<br>
<pre id="log"></pre>
<script>get();</script>
</body>
</html>