javascript - Angular $http.post is reporting failure, even though technically its working -


i have following controller:

function registerformctrl($scope, $http) {     $scope.master = {};     $scope.response = {};  $scope.update = function(reguser) {     reguser.contactinfo.name = "main";     reguser.contactinfo.phone = "333-333-3333";     reguser.contactinfo.address = "333 elm st indiana pa 15701";     reguser.contactinfo.email = "someemail@johnson.com";     reguser.name = "joe johnson";     reguser.username = "joe.johnson";     reguser.password1 = "abcdef123-";     reguser.password2 = "abcdef123-";      $scope.master = angular.copy(reguser);      $http.post('http://imac.local:8080/api/register', reguser)         .then(             function(response) {                 console.log("success");                 console.log(response);              },             function(response) {                 console.log("fail");                 console.log(response);              });  }; 

when trigger update method, $http.post kicks off , works technically. meaning fires sends right data server, server (restify) returns 201 , angular registers it.

request headers:

user-agent: mozilla/5.0 (macintosh; intel mac os x 10.9; rv:28.0) gecko/20100101         firefox/28.0 referer:    http://imac.local:8000/app/? pragma: no-cache origin: http://imac.local:8000 host:   imac.local:8080 content-type:   application/json;charset=utf-8 content-length: 222 connection: keep-alive cache-control:  no-cache accept-language:    en-us,en;q=0.5 accept-encoding:    gzip, deflate accept: application/json, text/plain, */* 

response headers:

date:   sun, 06 apr 2014 19:21:16 gmt content-type:   application/json content-length: 333 connection: keep-alive 

result:

request url:    http://imac.local:8080/api/register request method:     post status code:    http/1.1 201 created 

however, failure method gets called, "fail" gets printed, , response object empty.
1 thing note, server running on different port on same machine: client: http://imac.local:8000 server: http://imac.local:8080

i bring up, because chrome wouldn't fire post have run in firefox because of non origin failure despite same domain locally.

i'm 3 days old far angular/node/js goes appreciated.

thanks in advance.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -