我正在使用另一個沒有問題的api,如下所示:
fetch("https://www.boredapi.com/api/activity").then(r => r.text()).then(console.log);
但這不起作用:
fetch("https://www.timeapi.io/api/Time/current/zone?timeZone=Brazil/East").then(r => r.text()).then(console.log);
使用上面的代碼,我得到一個空白回應:(
uj5u.com熱心網友回復:
這將回傳 cors 錯誤。
您可以使用后端下載資料或使用代理
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/475859.html
標籤:javascript api 拿来 获取 API
上一篇:空手道API框架-測驗依賴