Created
October 25, 2016 15:33
-
-
Save jgermade/36a19a3fb80f9a26afea8b9e410eb8f6 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
var request = new XMLHttpRequest(); | |
request.onreadystatechange = function() { | |
if(request.readyState === 4) { | |
if(request.status === 200) { | |
console.log(request.responseText); | |
} else { | |
console.error(request.status, request.statusText, request.responseText); | |
} | |
} | |
} | |
request.open('POST', 'http://hostname:post/api/endpoint', true); | |
request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); | |
request.send('foo=bar'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment