Skip to content

Instantly share code, notes, and snippets.

@FreeFly19
Last active July 5, 2016 08:16
Show Gist options
  • Select an option

  • Save FreeFly19/442772804572f16c4e8f7d4db8296eee to your computer and use it in GitHub Desktop.

Select an option

Save FreeFly19/442772804572f16c4e8f7d4db8296eee to your computer and use it in GitHub Desktop.
jQuery Params instead encodeURLComponent
var data = "username=" + encodeURIComponent($scope.username) +
"&password=" + encodeURIComponent($scope.password);
$http({
method: 'POST',
url: 'login',
data: data,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(...);
$http({
method: 'POST',
url: 'login',
data: $.param({
username: $scope.username,
password: $scope.password
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(...);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment