Skip to content

Instantly share code, notes, and snippets.

@jbarros35
Created April 11, 2018 13: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 jbarros35/a1029d93bf0e5cee60ad5ba12ec493b1 to your computer and use it in GitHub Desktop.
Save jbarros35/a1029d93bf0e5cee60ad5ba12ec493b1 to your computer and use it in GitHub Desktop.
Angular http post
var data = $.param({
attr1: $scope.attr1,
attr2: $scope.attr2
});
var config = {
headers : {
'Content-Type': 'application/x-www-form-urlencoded'
}
};
$http.post('/pathtoserver', data, config)
.success(function (data, status, headers, config) {
if (data) {
// do something
}
})
.error(function (data, status, header, config) {
// do something
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment