Created
May 18, 2016 06:23
-
-
Save Naramsim/32f7b9d7fe7e2a1acaa847415e7e60ad to your computer and use it in GitHub Desktop.
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
var to_send = {} | |
to_send.title = "title"; | |
to_send.content = "content"; | |
to_send.author = "aut"; | |
to_send.language = "css"; | |
to_send = JSON.stringify(to_send); | |
var request = new XMLHttpRequest(); | |
request.open('POST', 'http://localhost:3000/api/v1/new', true); | |
request.setRequestHeader('Content-Type', 'application/json; charset=UTF-8'); | |
request.onreadystatechange = function () { | |
if (request.readyState == 4 && request.status == 200) { | |
var json = JSON.parse(request.responseText); | |
console.log(json); | |
} | |
} | |
request.send(to_send); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment