我正在尝试使用AngularJS从openweathermap.org API获取一个JSON,但我的请求返回了错误代码404。这是我的代码:
$scope.key = "XXXXXXXXXXXXX";
$scope.search = "Rouen";
$scope.url= "api.openweathermap.org/data/2.5/weather?q=" + $scope.search + "&APPID=" + $scope.key;
$scope.fetch = function(){
$http.get($scope.url)
.then(function(response){
$scope.res = response.data;
$scope.status= response.status;},
function errorCallback(response) {
alert(response.status);});
}
我已经尝试请求另一个URL,并且得到了与此相同的问题:http://www.omdbapi.com/?t=Sherlock%20Holmes&tomatoes=true&plot=full 有人知道这里出了什么问题吗?
如果有任何帮助,请谅解,我刚刚开始学习AngularJS,我在其他主题上没有找到任何解决方案。
谢谢您提前的答复!
我已经尝试请求另一个URL,并且得到了与此相同的问题:http://www.omdbapi.com/?t=Sherlock%20Holmes&tomatoes=true&plot=full 有人知道这里出了什么问题吗?
如果有任何帮助,请谅解,我刚刚开始学习AngularJS,我在其他主题上没有找到任何解决方案。
谢谢您提前的答复!