javascript - 通过 https 提供的站点中通过 http 的 API 数据,脚本有“混合内容”错误
问题描述
解决方案
你可以这样使用fetch
:
fetch("https://cors-anywhere.herokuapp.com/http://api.open-notify.org/iss-now.json", {
headers: { Origin: window.location.host }
})
.then(res => res.json())
.then(res => {
console.log(res);
// gotData(res);
})
.catch(err => {
console.log(err);
});
推荐阅读
- r - R ggplot2:如何根据带有 facet_wrap 的变量的值命名 y 轴?
- python - sklearn 随机森林分类器可以处理分类变量吗?
- javascript - 当我的数组被填充时如何调用函数
- csom - 没有使用 JSOM PS.ProjectContext get_projects 获得任何项目
- javascript - 是否可以根据其他 datetimepicker 中的选定日期禁用 datetimepicker 的先前日期
- amazon-cognito - AWS Cognito 预令牌生成 lambda 触发器
- php - 注意:未定义的索引:php中的文件
- r - 如何在 RMarkdown 的样式标签中包含@font-face?
- intellij-idea - IntelliJ 2020 更新更改字体
- flutter - 如何使用颤振将文件发送到 node.js 服务器?