javascript - Angularjs $http.post and $http.get empty response from API -
i'm trying information api, em run code bellow nothing. on firefox console :
app.controller('test', function($scope, $http) { $http.post("http://api.olhovivo.sptrans.com.br/v0/login/autenticar?token=fde20482b4aecc6334096c63a39d714a0ca379dd7ab599c4312c93161ce17781").success(function(data) { $scope.token = "oi"; }); $http.get("http://api.olhovivo.sptrans.com.br/v0/linha/buscar?termosbusca=9").then(function(response) { $scope.token = response; }); // http://api.olhovivo.sptrans.com.br/v0/login/autenticar?token=fde20482b4aecc6334096c63a39d714a0ca379dd7ab599c4312c93161ce17781 }).config(['$httpprovider', function($httpprovider) { $httpprovider.defaults.usexdomain = true; $httpprovider.defaults.withcredentials = true; delete $httpprovider.defaults.headers.common["x-requested-with"]; $httpprovider.defaults.headers.common["accept"] = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"; $httpprovider.defaults.headers.common["content-type"] = "application/x-www-form-urlencoded"; $httpprovider.defaults.headers.post['content-type'] = 'application/x-www-form-urlencoded;charset=utf-8'; $httpprovider.defaults.headers.post['content-length']= "0"; }]);
if paste , go same url(http://api.olhovivo.sptrans.com.br/v0/linha/buscar?termosbusca=9) on browser after run code, return json data need
thanks
Comments
Post a Comment