summaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--site/index.html21
-rw-r--r--site/thanks.html12
2 files changed, 31 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);
diff --git a/site/thanks.html b/site/thanks.html
new file mode 100644
index 0000000..1043ec3
--- /dev/null
+++ b/site/thanks.html
@@ -0,0 +1,12 @@
+<html>
+ <head>
+ <title>Thanks for answering the survey!</title>
+ <link rel="stylesheet" type="text/css" href="style.css">
+ </head>
+ <body>
+ <div>
+ <h1>Thanks for your answers!</h1>
+ <p>Your submission was sent and received successfully.</p>
+ </div>
+ </body>
+</html>