summaryrefslogtreecommitdiff
path: root/modules/lijst/lijst.html
blob: 0c1a3dd19b9d52ad9a7d670bc81f936f23feac48 (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
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Lijst</title>
<script>
function addItem() {
	var text = document.getElementById("text").value;

	var xhr = new XMLHttpRequest();
	xhr.open("POST", location.href + "/add");
	xhr.responseType = "text";
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4 && xhr.status == 200) {
			location.href = location.href;
		}
	};
	xhr.send(text);
}

function removeItem() {
	var xhr = new XMLHttpRequest();
	xhr.open("POST", location.href + "/remove");
	xhr.responseType = "text";
	xhr.onreadystatechange = function() {
		if (xhr.readyState == 4 && xhr.status == 200) {
			location.href = location.href;
		}
	};
	xhr.send();
}
</script>
<style>

</style>
</head>
<body>
<ol id="lijst">
<!--[[LIJST_ITEMS]]-->
</ol>
<input type="text" id="text" placeholder="New item text">
<input type="button" onclick="addItem()" value="Add item"><br>
<br>
<input type="button" onclick="removeItem()" value="Remove top item">
</body>
</html>