Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/450.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript I';我在使用metaweather/location api时遇到问题_Javascript_Json_Ajax_Api - Fatal编程技术网

Javascript I';我在使用metaweather/location api时遇到问题

Javascript I';我在使用metaweather/location api时遇到问题,javascript,json,ajax,api,Javascript,Json,Ajax,Api,我得到以下错误 crossorigin.me/:1 Failed to load resource: the server responded with a status of 522 () AJAX calls with FETCH and PROMISES.html:1 Access to fetch at 'https://crossorigin.me/https://www.metaweather.com/api/location/2487956/' from origin 'null'

我得到以下错误

crossorigin.me/:1 Failed to load resource: the server responded with a status of 522 ()
AJAX calls with FETCH and PROMISES.html:1 Access to fetch at 'https://crossorigin.me/https://www.metaweather.com/api/location/2487956/' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
AJAX calls with FETCH and PROMISES.html:18 TypeError: Failed to fetch
我试图通过crossorigin.me来解决这个问题,但没有成功


使用FETCH和promission进行AJAX调用
取('https://crossorigin.me/https://www.metaweather.com/api/location/2487956/')
。然后(结果=>{
控制台日志(结果);
})
.catch(错误=>{
console.log(错误);
});

我正在尝试相同的api

不幸的是,我发现crossorigin.me网站已不再维护,该域名现在已开始出售


好消息是还有其他方法可以做到这一点。此外,值得注意的是,在互联网上进行了一些搜索之后,MetaweatherAPI本身很难用ajax获取。很多用户都在与之抗争。所以你可以考虑使用不同的API。查看此github代码以供参考。我尝试了它,但它只需要稍作调整,因为它功能不全:

522是CloudFlare的响应,表示无法访问目标服务器(
crossorigin.me
metaweather.com
)。是否有任何可能的解决方案?不,您无能为力,除了给他们写一行和askis,还有其他的api吗?没有
crossorigin.me
,它能工作吗,因为这是一个有问题的api?