Created
April 24, 2017 01:47
-
-
Save luisnaranjo733/556535d2d3af89b7c69d3a74c8fcee9a to your computer and use it in GitHub Desktop.
How to make POST requests in JS
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
let data = new FormData(); | |
data.append('note', 'new note value yo!'); | |
let youth_visit_id = 1; | |
let url = `/api/visit/${youth_visit_id}/edit-note/`; | |
fetch(url, { | |
method: 'POST', | |
body: data | |
}).then(response => { | |
console.log('response'); | |
console.log(response); | |
console.log(`Status code: ${response.status}`) | |
}).catch(ex => { | |
console.log('exception'); | |
console.log(ex); | |
console.log(`Status code: ${response.status}`) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment