Working version
This commit is contained in:
parent
e6a699be6e
commit
384cb08dcc
@ -63,15 +63,20 @@ function jeanCloudContactFormIntercept (formId, theme) {
|
||||
method: formElem.method,
|
||||
body: new FormData(formElem)
|
||||
})
|
||||
|
||||
.then(data => {
|
||||
loadingText.parentNode.removeChild(loadingText)
|
||||
if (!data.ok || data.status == 500) {
|
||||
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Erreur du service d’envoi. Réessayez plus tard ou contactez https://jean-cloud.net')
|
||||
} else if (data.ok || data.status == 200) {
|
||||
if (data.ok && data.status == 200) {
|
||||
jeanCloudContactMailerMessage (messageBox, theme, 'success', 'Le message a bien été envoyé !')
|
||||
formElem.reset()
|
||||
} else if (!data.ok && data.status == 500) {
|
||||
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Erreur du service d’envoi. Réessayez plus tard ou contactez https://jean-cloud.net')
|
||||
} else if (!data.ok && data.status == 400) {
|
||||
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Une erreur est survenue dans la requête que vous avez effectué. Réessayez plus tard ou contactez le webmaster par un autre moyen.')
|
||||
// TODO display server’s error message
|
||||
}
|
||||
})
|
||||
|
||||
.catch((error) => {
|
||||
loadingText.parentNode.removeChild(loadingText)
|
||||
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Impossible d’envoyer le formulaire. Vérifiez votre connexion internet ou réessayez plus tard.')
|
||||
|
@ -6,7 +6,7 @@
|
||||
</head>
|
||||
<body>
|
||||
<div id="contact-mailer-message"></div>
|
||||
<form action="http://localhost:8080/submit" method="POST" id="contact-mailer-form">
|
||||
<form action="https://mailer.jean-cloud.net/submit" method="POST" id="contact-mailer-form">
|
||||
<input type="hidden" name="token" value="s0y6WANzU1XnYERoJxMwekP9pqilSVLK5Gbf3hmZadHB2rQ4u8" />
|
||||
<div>
|
||||
<label for="nom">Votre nom :</label>
|
||||
|
Loading…
Reference in New Issue
Block a user