当有括号时显示Rotten Tomatoes API的结果

时间:2016-04-05 18:11:43

标签: json api rotten-tomatoes

{
  "id": 770672122,
  "title": "Toy Story 3",
  "year": 2010,
  "genres": [
    "Animation",
    "Kids & Family",
    "Science Fiction & Fantasy",
    "Comedy"
  ],
  "mpaa_rating": "G",
  "runtime": 103,
  "critics_consensus": "Deftly blending comedy, adventure, and honest emotion, Toy Story 3 is a rare second sequel that really works.",
  "release_dates": {
    "theater": "2010-06-18",
    "dvd": "2010-11-02"
  }

我正在尝试展示这些类型。这是我的代码,但它不起作用。 有一些代码我没有显示,所以我不确定是否需要更多信息,但它表示长度未定义。

var movies = data.movies;
var abridged_cast = data.abridged_cast;

    $(".resultsContainer").innerHTML = "";
    var returnHTML = ""

    for(var i = 0; i < movies.length; i++){
        console.log(movies[i].title);
        returnHTML+=('<h1>' + movies[i].title + '</h1>');

    for(var k = 0; k < movies[i].genres.length; k++){
        console.log(movies[i].genres);
        returnHTML+=('<h1> Genre(s):' + movies[i].genres + '</h1>');
      }

0 个答案:

没有答案