【发布时间】:2021-07-15 00:13:31
【问题描述】:
我有这个:
<script>
function gettingJSON(){
$.getJSON("http://api.openweathermap.org/data/2.5/weather?q=London&appid=",function(json){
console.log(JSON.stringify(json));
});
}
</script>
当我运行它并查看我的控制台时,我得到了这个错误:
[Error] Failed to load resource: the server responded with a status of 401 (Unauthorized) (weather, line 0)
我的 api 密钥与 openweathermap 仪表板中的那个匹配,所以想知道它不能正常工作。也许我错过了一些东西。有什么想法吗?
【问题讨论】: