angularjs - success is not defined in Angular $http.jsonp -


i'm making $http.jsonp request in angular/phonegap app. data being delivered remote server, can't response success function in angular app. console telling me 'success not defined.'

here angular code:

app.controller('maincontrol' , function($scope , $http){ $scope.credentials = {username: '' , password: ''};  $scope.login = function(){ console.log($scope);  var url = "http://127.0.0.1:3000/endpoint?callback=json_callback"; var responsepromise = $http.jsonp(url, {params: {   username:$scope.credentials.username,   password:$scope.credentials.password }});  responsepromise.success(function (data){   console.log(data); }) }  }) 

am missing step in order define success?

i believe jsonp have use .then method of handling promise resolution:

responsepromise.then(function (data){     //success things go here     console.log(data); }, function(data({     //error things go here }); 

Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -