我试图用AngularJS来从openweathermap.org API一个JSON,但我的请求返回错误代码404。这里是我的代码:AngularJS http.get返回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);});
我已经尝试请求另一个网址,并且得到了与此相同的问题:http://www.omdbapi.com/?t=Sherlock%20Holmes&tomatoes=true&plot=full
有人对这里有什么错误有所了解吗?
请原谅我,如果这是显而易见的,我是AngularJS的全新产品,并且我还没有在其他主题上找到任何解决方案。
非常感谢您的回答!
哪里是'//'? – epascarello
这是错误,缺乏http://,愚蠢的^^谢谢 –