Skip to content

Commit 7098429

Browse files
authored
Fix message sending (#27)
1 parent cca8766 commit 7098429

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

contact.html

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
43
<head>
54
<link rel="icon" type="image/x-icon" href="images/favicon.ico">
65
<meta charset="UTF-8">
@@ -10,7 +9,6 @@
109
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet">
1110
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
1211
</head>
13-
1412
<body class="bg-gray-200">
1513

1614
<!-- Header Section -->
@@ -100,7 +98,7 @@ <h2 class="text-3xl font-semibold mb-4">Contact Form</h2>
10098
message: document.getElementById('message').value
10199
};
102100

103-
fetch('https://kshs-form-production.up.railway.app/', {
101+
fetch('https://kshs-form-production.up.railway.app/contact', {
104102
method: 'POST',
105103
headers: {
106104
'Content-Type': 'application/json'
@@ -109,7 +107,11 @@ <h2 class="text-3xl font-semibold mb-4">Contact Form</h2>
109107
})
110108
.then(response => response.json())
111109
.then(data => {
112-
alert('Your message has been sent!');
110+
if (data.success) {
111+
alert('Your message has been sent!');
112+
} else {
113+
alert('There was an error sending your message: ' + data.message);
114+
}
113115
})
114116
.catch(error => {
115117
alert('There was an error sending your message.');

0 commit comments

Comments
 (0)