Last active
May 5, 2019 05:10
-
-
Save seunggabi/dc173f72b8b5c8f0909c8b6bea7e747b to your computer and use it in GitHub Desktop.
post.js
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 post(url, body) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("POST", url, true); | |
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); | |
xhr.onreadystatechange = function() { | |
if (this.readyState === XMLHttpRequest.DONE && this.status === 200) { | |
console.log(this); | |
console.log(url, body); | |
} | |
}; | |
xhr.send(body); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment