File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
< html lang ="en ">
3
-
4
3
< head >
5
4
< link rel ="icon " type ="image/x-icon " href ="images/favicon.ico ">
6
5
< meta charset ="UTF-8 ">
10
9
< link href ="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css " rel ="stylesheet ">
11
10
< script src ="https://code.jquery.com/jquery-3.6.0.min.js "> </ script >
12
11
</ head >
13
-
14
12
< body class ="bg-gray-200 ">
15
13
16
14
<!-- Header Section -->
@@ -100,7 +98,7 @@ <h2 class="text-3xl font-semibold mb-4">Contact Form</h2>
100
98
message : document . getElementById ( 'message' ) . value
101
99
} ;
102
100
103
- fetch ( 'https://kshs-form-production.up.railway.app/' , {
101
+ fetch ( 'https://kshs-form-production.up.railway.app/contact ' , {
104
102
method : 'POST' ,
105
103
headers : {
106
104
'Content-Type' : 'application/json'
@@ -109,7 +107,11 @@ <h2 class="text-3xl font-semibold mb-4">Contact Form</h2>
109
107
} )
110
108
. then ( response => response . json ( ) )
111
109
. 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
+ }
113
115
} )
114
116
. catch ( error => {
115
117
alert ( 'There was an error sending your message.' ) ;
You can’t perform that action at this time.
0 commit comments