blob: 4becabe8460dffbd1e630c1860781ecd7b915521 (
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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Axum Echo</title>
</head>
<body>
<h1>Axum Echo Demo</h1>
<input id="name" type="text" placeholder="Your name" />
<button onclick="send()">Send</button>
<br><br>
<textarea id="output" rows="5" cols="40"></textarea>
<script>
async function send() {
const name = document.getElementById("name").value;
const res = await fetch(`/api/echo?name=${encodeURIComponent(name)}`, {
method: "POST"
});
const data = await res.json();
document.getElementById("output").value =
`Hello ${data.name}\nSession ID: ${data.session_id}`;
localStorage.setItem("session_id", data.session_id);
}
</script>
</body>
</html>
|