Skip to content

Instantly share code, notes, and snippets.

@daz4126
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daz4126/1017f455f58aa29f3e6c to your computer and use it in GitHub Desktop.
Save daz4126/1017f455f58aa29f3e6c to your computer and use it in GitHub Desktop.
Sending some ajax data to reqr.es
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