-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcryptoquote.html
54 lines (46 loc) · 1.59 KB
/
cryptoquote.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
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet">
<style>
body {
font-family: 'Nunito', sans-serif;
background-color: #F5F5DC;
}
h1 {
margin: 0;
}
h2 {
margin: 0;
}
</style>
</head>
<body>
<center>
<h1>Poly Cryptoquote</h1>
<br>
<form onSubmit="post(); return false;">
Cryptoquote:<br>
<input id="cryptoquote" type="text" name="cryptoquote"><br><br>
<input type="button" value="Submit" onClick="post()">
</form>
<center>
<script>
function post() {
var original = document.getElementById("cryptoquote").value;
var xhr = new XMLHttpRequest();
xhr.open('POST', '', false);
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xhr.onload = function() {
if (xhr.status === 200) {
document.body.innerHTML = "<center><h1>Completed cryptoquote for \"" + original + "\"</h1><br><h2>" + xhr.responseText + "</h2><center>";
}
else if (xhr.status !== 200) {
alert('Request failed. Returned status of ' + xhr.status);
}
};
xhr.send(encodeURI('cryptoquote=' + original));
}
</script>
</body>
</html>