summaryrefslogtreecommitdiff
path: root/site/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'site/index.html')
-rw-r--r--site/index.html21
1 files changed, 19 insertions, 2 deletions
diff --git a/site/index.html b/site/index.html
index 2fc90e7..6dc12fa 100644
--- a/site/index.html
+++ b/site/index.html
@@ -1,5 +1,6 @@
<html>
<head>
+ <meta charset="UTF-8">
<title>test</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
@@ -135,10 +136,13 @@
let footer = mkElement("section");
let submit = mkElement("button", "Submit");
+ let errormsg = mkElement("p", "");
appendChildren(footer, [
mkElement("hr"),
- submit
+ submit,
+ errormsg
]);
+ errormsg.hidden = true;
submit.onclick = () => {
// the callback over the complete survey just maps all
// other callbacks to their values, i.e. calls them all
@@ -159,7 +163,20 @@
"X-Survey": survey.title,
"Content-Type": "text/age"
}
- }).then(response => console.log(response.text()))
+ }).then(response => {
+ console.log(response);
+ if (response.status === 200) {
+ console.log(response.text())
+ window.location.href = "thanks.html";
+ }
+ errormsg.innerText = "POST request returned error code: "
+ + response.status + ": " + response.statusText;
+ errormsg.hidden = false;
+ }).catch(error => {
+ console.log(error);
+ errormsg.innerText = "Error: The http POST request did not succeed.";
+ errormsg.hidden = false;
+ });
}
root.appendChild(footer);