Skip to content

Instantly share code, notes, and snippets.

@tristar500
Created May 15, 2014 20:21
Show Gist options
  • Save tristar500/abbe77595ff91d79801a to your computer and use it in GitHub Desktop.
Save tristar500/abbe77595ff91d79801a to your computer and use it in GitHub Desktop.
Send $_POST using AngularJS
/// ******************************************
///
/// There are crazy gyrations required post data from angular.
/// http://stackoverflow.com/questions/11442632/how-can-i-make-angular-js-post-data-as-form-data-instead-of-a-request-payload
///
/// ******************************************
var xsrf = $.param(selectedItem);
$http({
method: "POST",
url: 'updateuser',
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
data: xsrf
})
.success(function( result, status){
})
.error(function( result, status){
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment