Hello,
I am trying to make a post request using angularjs $http. The
implementation looks something like this:
Assume $scope.user is an object that has been initialized like this:
*$scope.user = {};*
*$scope.user.username = 'my-user-name';*
*$scope.user.password = 'my-password';*
*then, when hitting the 'Submit button' this script should execute:*
*$http({*
* method: 'POST',*
* url: 'url-to-api',*
* headers: {*
* 'Content-Type':'application/x-www-form-urlencoded',*
* 'Access-Control-Allow-Origin':'*'*
* },*
* //-- this section produces the same output as *
* //-- angular.element.param( object ) *
* //transformRequest: function(obj) {*
* // var str = [];*
* // for(var p in obj)*
* // str.push(encodeURIComponent(p) + "=" +
encodeURIComponent(obj[p]));*
* // return str.join("&");*
* //},*
* //data: $scope.user *
* data: angular.element.param($scope.user)*
*});*
--------------------------------------------------------------
The above code works in IE 10 and above. More details of the POST request
can be seen in the attached *edge.PNG* file (the http post request in
question is highlighted in yellow).
However in IE 9 it doesn't work. The $http POST request error callback is
called right away, as if the request didn't go at all (in fact it is not
captured by the IE console window). For more details please checkout the
files *ie.PNG and ie-error.PNG*
PS: the calls are cross-domain, but even if I put the 'withCredentials:
true' in the POST request it still doesn't work.
Thanks in advance!!
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.