Skip to content

Latest commit

 

History

History
58 lines (53 loc) · 1.82 KB

contact.md

File metadata and controls

58 lines (53 loc) · 1.82 KB
layout title permalink
default
Contact
/contact/

If you have any questions, suggestions or inquiries, feel free to reach out to us using the form below -- or write us an email directly here:

Name: Surname: Affiliation (leave empty if none): Email: Message: <textarea name="message"></textarea> Submit

<script> var form = document.getElementById("my-form"); async function handleSubmit(event) { event.preventDefault(); var status = document.getElementById("my-form-status"); var data = new FormData(event.target); fetch(event.target.action, { method: form.method, body: data, headers: { 'Accept': 'application/json' } }).then(response => { if (response.ok) { status.innerHTML = "Thanks for your submission!"; form.reset() } else { response.json().then(data => { if (Object.hasOwn(data, 'errors')) { status.innerHTML = data["errors"].map(error => error["message"]).join(", ") } else { status.innerHTML = "Oops! There was a problem submitting your form" } }) } }).catch(error => { status.innerHTML = "Oops! There was a problem submitting your form" }); } form.addEventListener("submit", handleSubmit) </script>