Created
March 29, 2018 12:10
-
-
Save numfin/7d218040edbdf31903ea1c9799fda228 to your computer and use it in GitHub Desktop.
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
const body = { | |
message: 'hi' | |
} | |
const data = new FormData(); | |
data.append( "json", JSON.stringify( body ) ); | |
fetch("/echo/json/", { | |
method: "POST", | |
body: data | |
}) | |
.then(function(res){ return res.json(); }) | |
.then(function(data){ console.log(JSON.stringify(data)) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment