fetch
<div id="fetch-api"></div>
<script>
const URL = 'https://jsonplaceholder.typicode.com/todos/5';
fetch(URL)
.then(res => res.json())
.then(data => {
document.getElementById("fetch-api").innerHTML +=
"从 API 获取的 data: " + "<br>" +
JSON.stringify(data);
});
</script>