【发布时间】:2020-07-20 11:00:18
【问题描述】:
我有这个 json 数据 URL,我只想选择法国数据以 html 显示,但我不知道该怎么做。请帮我这样做
https://coronavirus-19-api.herokuapp.com/countries
这是我的 JAVASCRIPT
// API Fetch Call
const api_url = './src/india.json';
async function getCcount() {
const response = await fetch(api_url);
const data = await response.json();
const {
cases,
active,
deaths,
recovered
} = data;
document.getElementById('t-count').textContent = cases;
document.getElementById('a-count').textContent = active;
document.getElementById('d-count').textContent = deaths;
document.getElementById('r-count').textContent = recovered;
}
getCcount();
如何仅选择法国数据以 HTML 格式显示。使用 fetch 函数。
【问题讨论】:
标签: javascript html json api