Working version
This commit is contained in:
parent
e6a699be6e
commit
384cb08dcc
@ -63,15 +63,20 @@ function jeanCloudContactFormIntercept (formId, theme) {
|
|||||||
method: formElem.method,
|
method: formElem.method,
|
||||||
body: new FormData(formElem)
|
body: new FormData(formElem)
|
||||||
})
|
})
|
||||||
|
|
||||||
.then(data => {
|
.then(data => {
|
||||||
loadingText.parentNode.removeChild(loadingText)
|
loadingText.parentNode.removeChild(loadingText)
|
||||||
if (!data.ok || data.status == 500) {
|
if (data.ok && data.status == 200) {
|
||||||
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) {
|
|
||||||
jeanCloudContactMailerMessage (messageBox, theme, 'success', 'Le message a bien été envoyé !')
|
jeanCloudContactMailerMessage (messageBox, theme, 'success', 'Le message a bien été envoyé !')
|
||||||
formElem.reset()
|
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) => {
|
.catch((error) => {
|
||||||
loadingText.parentNode.removeChild(loadingText)
|
loadingText.parentNode.removeChild(loadingText)
|
||||||
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Impossible d’envoyer le formulaire. Vérifiez votre connexion internet ou réessayez plus tard.')
|
jeanCloudContactMailerMessage (messageBox, theme, 'error', 'Impossible d’envoyer le formulaire. Vérifiez votre connexion internet ou réessayez plus tard.')
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="contact-mailer-message"></div>
|
<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" />
|
<input type="hidden" name="token" value="s0y6WANzU1XnYERoJxMwekP9pqilSVLK5Gbf3hmZadHB2rQ4u8" />
|
||||||
<div>
|
<div>
|
||||||
<label for="nom">Votre nom :</label>
|
<label for="nom">Votre nom :</label>
|
||||||
|
Loading…
Reference in New Issue
Block a user