html - 在功能 js 的屏幕上查看打印结果
问题描述
function findBrother(name) {
fetch(urlBrother +name)
.then((response) => {
if (response.status === 200) {
return response.json();
} else throw new Error(response.status);
})
.then((data) => {
const brotherName = data[0].name
const flagCountry = data[0].flag
if (data[0].brother.length > 0) {
console.log(data[0].brother);
console.log(data[0].flag);
document.getElementById("_flag").innerHTML=flagCountry;
该函数位于文件 A.js 中,我想打印 flagCountry 的结果。我如何在 HTML 中做到这一点?这是来自网址的图像。
解决方案
推荐阅读
- ios - beginBackgroundTask expirationHandler 从未调用过
- r - R:当行超过100k时读取xlsx不读取excel文件
- python - 动态创建组合框并重置值 TKinter
- python - 如何将 [1,2,3...20] 列表更改为 [[1,2..20], [20,19....1]] 嵌套列表?
- amazon-dynamodb - DynamoDB - 通过全局二级索引获取项目
- mysql - MySQL InnoDB 行限制与 TEXT 列
- javascript - Angular 检测组件的 DOM 何时完成渲染
- javascript - 如何从嵌套字段中获取数组的总和 ($sum)?
- sql - BigQuery 缺少 SUM OVER PARTITION BY 的行
- terraform - 使用 walk 递归聚合 rego 的 terraform 状态的资源