Created
September 30, 2022 18:16
-
-
Save anova/c837481e5c30a463c7ff95a69339f4ff to your computer and use it in GitHub Desktop.
Send POST form data, serialized by FormData with fetch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const the_form = document.getElementById('the_form'); | |
const formData = new FormData(the_form); | |
fetch('the-handler.php',{ | |
method: 'POST', | |
body: formData | |
}) | |
.then(response => response.json()) | |
.then(data => { | |
console.log('data is:', data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment