-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpost-survey.html
More file actions
87 lines (79 loc) · 2.38 KB
/
Copy pathpost-survey.html
File metadata and controls
87 lines (79 loc) · 2.38 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Final Survey</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
margin: 50px;
}
textarea, select {
width: 80%;
max-width: 600px;
margin-top: 10px;
padding: 10px;
font-size: 16px;
}
button {
margin-top: 20px;
padding: 10px 20px;
font-size: 16px;
background-color: #0095f6;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #0078d4;
}
</style>
</head>
<body>
<h1>Final Survey</h1>
<p>11. Have you changed your mind about any topics discussed in the feed? If so, which ones and why?</p>
<textarea id="q11" rows="4"></textarea>
<p>12. What content interested you the most and why?</p>
<textarea id="q12" rows="4"></textarea>
<p>13. How would you rate your ability to spot fake news?</p>
<select id="q13">
<option value="">-- Select an option --</option>
<option value="very good">very good</option>
<option value="bonne">bonne</option>
<option value="the average">the average</option>
<option value="mauvaise">mauvaise</option>
<option value="very bad">very bad</option>
</select>
<p>14. Other comment</p>
<textarea id="q14" rows="3"></textarea>
<br/>
<button onclick="submitPostSurvey()">Submit</button>
<script>
function submitPostSurvey() {
const userId = localStorage.getItem("userId") || "unknown";
const firstName = localStorage.getItem("firstName") || "Anonymous";
const postSurveyData = {
userId,
firstName,
q11: document.getElementById("q11").value.trim(),
q12: document.getElementById("q12").value.trim(),
q13: document.getElementById("q13").value,
q14: document.getElementById("q14").value.trim()
};
fetch("/log-post-survey", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(postSurveyData)
})
.then(() => {
alert("Thank you! Your answers have been submitted.");
window.location.href = "/"; // or redirect elsewhere
})
.catch(err => console.error("Error submitting post-survey:", err));
}
</script>
</body>
</html>