Last active
April 21, 2016 13:45
-
-
Save trahloff/7a5ec88929204fd8acf1838d41dd5dda to your computer and use it in GitHub Desktop.
PA0 code snippets
This file contains 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
// 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