Skip to content

Instantly share code, notes, and snippets.

@kesarawimal

kesarawimal/fetch.js

Last active Feb 15, 2021
Embed
What would you like to do?
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));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment