forked from engineerOfLies/rabbitmqphp_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathremind_me.html
More file actions
47 lines (42 loc) · 1.54 KB
/
Copy pathremind_me.html
File metadata and controls
47 lines (42 loc) · 1.54 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Remind Me</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<h1>Remind Me About My Upcoming Event</h1>
<button id="remindMeBtn" class="btn btn-primary">Remind Me</button>
<p id="responseMessage" class="mt-3"></p>
</div>
<script>
document.getElementById('remindMeBtn').addEventListener('click', function () {
const token = localStorage.getItem('token');
if (!token) {
alert("You must be logged in.");
return;
}
fetch('remind_me_sender.php', {
method: 'POST',
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
body: `token=${encodeURIComponent(token)}`
})
.then(response => response.json())
.then(data => {
const responseMessage = document.getElementById('responseMessage');
if (data.status === 'success') {
responseMessage.textContent = "Reminder sent successfully!";
responseMessage.classList.add('text-success');
} else {
responseMessage.textContent = `Error: ${data.message}`;
responseMessage.classList.add('text-danger');
}
})
.catch(error => console.error('Error:', error));
});
</script>
</body>
</html>