Created
April 28, 2021 12:32
-
-
Save costa86/97436a9f58fcf4f029526862113ee5cc to your computer and use it in GitHub Desktop.
Send post request using vanilla JavaScript, no jQuery, no Ajax
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
async function sendPostRequestToURL(bodyData, url) { | |
let submission = await fetch(url, { | |
method: 'post', | |
headers: { | |
'Content-Type': 'application/json' | |
}, | |
body: JSON.stringify(bodyData) | |
}); | |
return submission.status; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment