我是JavaScript的新手,这是我第一次使用API。 因此我试图获取MetaWeather API的方式
fetch('https://crossorigin.me/https://www.metaweather.com/api/location/2487956/');
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Asynchronous JavaScript</title>
</head>
<body>
<h1>Asynchronous JavaScript</h1>
</body>
</html>
我遇到了这两个错误,我真的不明白为什么。
asynchronous.html:101 GET https://crossorigin.me/https://www.metaweather.com/api/location/2487956/ net :: ERR_CONNECTION_RESET (匿名)@异步.html:101 异步.html:1未捕获(承诺)TypeError:无法提取
答案 0 :(得分:1)
尝试在该代理之后放置网址:https://cors-anywhere.herokuapp.com/而不是https://crossorigin.me/
对我有用。