Last active
January 2, 2020 11:53
-
-
Save seunggabi/6aa43dbcf4d5238d940f7b0b49fee989 to your computer and use it in GitHub Desktop.
requestUtils.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 requestUtils(method, url, body) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open(method, url, true); | |
xhr.withCredentials = 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