如何在没有jQuery的情况下使用$http发布经过urlencode编码的表单数据?
$http
$http({ method: "post", url: URL, headers: {'Content-Type': 'application/x-www-form-urlencoded'}, data: $.param({username: $scope.userName, password: $scope.password})}).success(function(result){ console.log(result);});
$.param
data: {username: $scope.userName, password: $scope.password}
params
:
params: {username: $scope.userName, password: $scope.password}
JSON.stringify
:
data: JSON.stringify({username: $scope.userName, password: $scope.password})
相关分类