Created
April 11, 2018 13:08
-
-
Save jbarros35/a1029d93bf0e5cee60ad5ba12ec493b1 to your computer and use it in GitHub Desktop.
Angular http post
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
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