Created
March 26, 2018 00:52
-
-
Save soaxelbrooke/a85ee519dc773ae507a298624cdf291d to your computer and use it in GitHub Desktop.
Submitting form data with fetch in JavaScript
This file contains hidden or 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
function postTagData(myUrl, documentId, fullText, tag, start, end) { | |
let form = new FormData(); | |
form.set('document_id', documentId); | |
form.set('full_text', fullText); | |
form.set('region_start', start); | |
form.set('region_end', end); | |
return window.fetch(myUrl, { | |
method: 'POST', | |
body: form | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment