← 返回教程列表
🔄 AJAX 教程
Fetch API
fetch("/api/users")
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("错误:", error));
// async/await 方式
async function loadData() {
let response = await fetch("/api/users");
let data = await response.json();
console.log(data);
}