Saturday 15 January 2011

javascript - $http.post angularjs do not get in to success or error -



javascript - $http.post angularjs do not get in to success or error -

my code this

$http.post("../services/myurl.aspx?param=" + finaldata, '', { 'content-type': 'text' }). success(function (pricedata) { alert (success) }). error(function () { alert('we have failed create connection server. please seek after time'); });

when makes phone call neither success nor error happens.but service called. little confused. can 1 point out doing wrong?

you should utilize service post data, here how it.

dosomething: function (data, url) { homecoming $http({ url: url, method: 'post', data: info }); },

and in controller consume service as

someservice.dosomething($scope.mydata, $scope.url) .success(function (response) { console.log("success", response); }) .error(function (data, status, headers, config) { console.log("error"); });

javascript angularjs

No comments:

Post a Comment