-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
40 lines (33 loc) · 902 Bytes
/
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Try Out Noise Search</title>
</head>
<body id="home">
<h1>Try out Noise queries in your browser!</h1>
<script type="text/javascript">
function doSubmit() {
var q = document.getElementById("query").value
var xhr = new XMLHttpRequest();
xhr.addEventListener("load", resp => {
if(xhr.readyState == 4) {
var el = document.getElementById("results");
el.textContent = xhr.responseText;
}
});
xhr.open("POST", "/query");
xhr.setRequestHeader("Content-Type", 'application/json');
xhr.send(q);
}
</script>
<form name="form">
query:<br>
<textarea id="query" rows="4" cols="50">
find {"name": == "Seinfeld"} return .
</textarea>
</form>
<button onclick="doSubmit();">Click me</button>
<pre id="results"></pre>
</body>
</html>