angularjs - $http jsonp response in error callback -


i working jsonp using angular $http service.

the server require basic auth, setup in app startup,

 angular.module('app')         .run(['$route', 'base64', '$http', function ($route, base64, $http) {              //hook routing             var encoded = base64.encode("username" + ':' + "password");             $http.defaults.headers.common['authorization'] = 'basic ' + encoded;         }]); 

and here jsonp call trying make

  function getfilms(company){     $http.jsonp(config.serviceurl + 'moment/films', {                 params: {                     callback: 'json_callback',                     project: company                 }             }).success(function (data) {                 console.log(data);              }).error(function (data,status) {                  console.log(status);             });       } 

the problem is, response comes in error callback instead of success callback. has been setup on backend , checked out log on server, nothing seems wrong. not sure why it's not return response in success callback. suggestion please?


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -