-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
44 lines (41 loc) · 1.11 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<div>
<input type="text" name="input-text" id="input-text">
<button type="button" onclick="pow()">Pow</button>
<button type="button" onclick="concat()">Concat</button>
<h2 id="demo"></h2>
</div>
<script>
function ajaxCall(path) {
const xhttp = new XMLHttpRequest();
xhttp.onload = function() {
document.getElementById("demo").innerHTML = this.responseText;
}
xhttp.open("GET", path, true);
xhttp.send();
}
function pow() {
var inputValue = document.getElementById("input-text").value;
if (inputValue != "") {
var path = "pow/" + inputValue;
ajaxCall(path);
}
}
function concat() {
var inputValue = document.getElementById("input-text").value;
if (inputValue != "") {
var path = "concat/" + inputValue;
ajaxCall(path);
}
}
</script>
</body>
</html>