我正在尝试使用 javascript 构建一个 API,以从此 URL 获取数据以获取 json 数据: img, a, c 。但是下面的代码抛出了一个错误application.js:10 Uncaught (in promise) TypeError: data.forEachis not a function(为什么forEach没有定义方法)你能帮忙吗?谢谢var results = document.getElementById("results");fetch("https://www.mangaeden.com/api/list/0/") .then(response => response.json()) .then((data) => { data.forEach((result) => { const movies = '<li><img src="' + result.im + '" alt=""><h3>' + result.a + '</h3><p>' + result.c + '</p></li>'; results.insertAdjacentHTML("beforeend", movies); }); });{ "a": "shoujo-apocalypse-adventure", "c": [ "Adventure", "Drama", "Psychological", "Sci-fi", "Seinen", "Slice of Life", "Tragedy" ], "h": 156, "i": "5c410d31719a16035a4647cc", "im": "4a/4a1f2a595e0e84e62f6ceddf3946274478928ca99e8df86bc6511b6e.png", "ld": 1547822837.0, "s": 2, "t": "Shoujo Apocalypse Adventure"},
添加回答
举报
0/150
提交
取消