![](/img/trans.png)
[英]Why the same POST request works in POSTMAN but not in browser AJAX (404 Not Found)?
[英]Browser get request 404'd but works with Postman app
标题说明了一切,尝试使用 openweather api 检索一些数据。
它在 Postman 上运行良好,但是在本地环境中使用 vanillaJS 时,我在控制台中收到一条错误消息
ERROR: GET http://127.0.0.1:5500/api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY 404 (Not Found)
我的代码看起来像这样
axios.get(`api.openweathermap.org/data/2.5/forecast?id=2193733&appid=MYAPIKEY`)
.then(response => {
console.log(response);
})
有任何想法吗?
您正在运行 axios 的应用程序顶部收到发送的请求。
尝试axios.get('http://api.openwheather...')
它应该可以工作
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.