Skip to content

Instantly share code, notes, and snippets.

@trahloff
Last active April 21, 2016 13:45
Show Gist options
  • Save trahloff/7a5ec88929204fd8acf1838d41dd5dda to your computer and use it in GitHub Desktop.
Save trahloff/7a5ec88929204fd8acf1838d41dd5dda to your computer and use it in GitHub Desktop.
PA0 code snippets
// AngularJS:
$http.post('http://example.com', { username: "username" }, function (data) {
console.log(data);
})
// Vanilla:
var httpRequest = new XMLHttpRequest()
httpRequest.onreadystatechange = function (data) {
console.log(data);
}
httpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
httpRequest.open('POST', 'http://example.com')
httpRequest.send('username=' + encodeURIComponent("username"))
// https://gist.github.com/liamcurry/2597326#post
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment