答案 0 :(得分:0)
首先,您需要获取.json文件
var moviedbRequest = new XMLHttpRequest();
moviedbRequest.addEventListener("load", parseMovies);
moviedbRequest.open("GET", "moviedb.json");
moviedbRequest.send();
您需要将JSON解析为对象,然后从该对象获取backdrop_path并将其附加到基本URL
function parseMovies() {
var data = JSON.parse(moviedbRequest.responseText);
var url = 'https://image.tmdb.org/t/p/original' + data.backdrop_path;
}
然后,您的图像网址将存储在名为url