Skip to content

Instantly share code, notes, and snippets.

@kesarawimal
Last active March 5, 2024 00:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kesarawimal/53d4308a8234638b88275225c32a11b6 to your computer and use it in GitHub Desktop.
Save kesarawimal/53d4308a8234638b88275225c32a11b6 to your computer and use it in GitHub Desktop.
FormSubmit AJAX Documentation: Fetch
// https://github.com/github/fetch
fetch("https://formsubmit.co/ajax/your@email.com", {
method: "POST",
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
name: "FormSubmit",
message: "I'm from Devro LABS"
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.log(error));
@SamuelMiller
Copy link

Please give an HTML contact form example of how to implement this for us beginners. Thanks.

@kesarawimal
Copy link
Author

Please give an HTML contact form example of how to implement this for us beginners. Thanks.

You can find an interactive example on the FormSubmit website: https://formsubmit.co/live-demo

@f-deniyi
Copy link

f-deniyi commented Mar 7, 2023

How do I prevent captcha using this

@kesarawimal
Copy link
Author

How do I prevent captcha using this

There is an option to disable the reCaptcha, kindly read the documentation here: https://formsubmit.co/documentation

@nflnsr
Copy link

nflnsr commented Jul 2, 2023

I get SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON.
Any solution?

@yazn-108
Copy link

yazn-108 commented Mar 5, 2024

How can I change the display template in the mail if using ajax?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment