Last active
August 29, 2015 14:08
-
-
Save daz-codes/1017f455f58aa29f3e6c to your computer and use it in GitHub Desktop.
Sending some ajax data to reqr.es
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
data = { | |
name: "paul rudd", | |
movies: ["I Love You Man", "Role Models"] | |
} | |
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = function(){ | |
if (xhr.readyState === 4 && xhr.status === 201) { | |
console.log(xhr.response); | |
} | |
} | |
xhr.open("POST", "http://reqr.es/api/users", true); | |
xhr.send(stringify(data)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment