Javascript JSONP请求未在Angular JS中获取结果
我使用JSONP请求AngularJs中的三个URL 这是我第一次得到这些值。但在第二次呼叫后,我没有得到任何价值。 当我看到控制台时,我发现了这个错误 例外:TypeError:“调用者”、“被调用者”和“参数”属性 不能在严格模式函数或参数对象上访问 打电话给他们 这个错误是什么意思 这是我的示例代码Javascript JSONP请求未在Angular JS中获取结果,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我使用JSONP请求AngularJs中的三个URL 这是我第一次得到这些值。但在第二次呼叫后,我没有得到任何价值。 当我看到控制台时,我发现了这个错误 例外:TypeError:“调用者”、“被调用者”和“参数”属性 不能在严格模式函数或参数对象上访问 打电话给他们 这个错误是什么意思 这是我的示例代码 appPortal.controller('HistoCtrl', ['$rootScope', '$scope', '$http', '$location', function($r
appPortal.controller('HistoCtrl', ['$rootScope', '$scope', '$http', '$location',
function($rootScope, $scope, $http, $location) {
console.log($rootScope);
$scope.url1 = '';
$scope.url2 = '';
$scope.url3 = '';
//request handler
$scope.sendDataRequest = function() {
$http.jsonp($scope.url1).then(function(msg) {
console.log(msg.data);
});
$http.jsonp($scope.url2).then(function(msg) {
console.log(msg.data);
});
$http.jsonp($scope.url3).then(function(msg) {
console.log(msg.data);
});
};
//get current month data
$scope.getCurrentMonthData = function() {
$scope.url1 = $rootScope.ApiWeatherHost + '/climo/v1/actuals/' + $scope.location_key + '?callback=JSON_CALLBACK&start=' + $scope.start + '&end=' + $scope.end + '&apikey=' + $rootScope.ApiKey;
$scope.url2 = $rootScope.ApiWeatherHost + '/climo/v1/records/' + $scope.location_key + '?callback=JSON_CALLBACK&start=' + $scope.start + '&end=' + $scope.end + '&apikey=' + $rootScope.ApiKey;
$scope.url3 = $rootScope.ApiWeatherHost + '/climo/v1/normals/' + $scope.location_key + '?callback=JSON_CALLBACK&start=' + $scope.start + '&end=' + $scope.end + '&apikey=' + $rootScope.ApiKey;
$scope.sendDataRequest();
};
}
]);
我正在尝试使用Jsonp获取这些RESTAPI
可能会显示更多代码,您说过您发出了三个请求。@dfsq请查看更新后的帖子。谢谢。@dfsq请参考此。。我也有类似的问题@dfsq我看到了对我的url的请求。out out未连接角度回调0.1。这在jsonp请求的输出中是必需的吗?请尝试此处引用的解决方案: