public/js/index.js
// generate the section including rank and top movies in that genre 
generate the section including rank and top movies in that genre
generate the section including rank and top movies in that genre
function generateGenreSection(genre_name, rank, response){
      console.log(genre_name, rank, response)
      $('.genreResult').first().show()
      $('.genreResult').last().clone().appendTo('.result')
      $('.genreResult').first().hide()
      $('.genreTitle').last().text((genre_name).toUpperCase())
      $('.genreRank').last().text("#"+rank)
      $('.header').last().text("Top Movies for " + genre_name)
      for(var i = 0; i < 3; i++){
        var posterPath = response.results[i].poster_path
        var title = response.results[i].title
        var imgsrc = "https://image.tmdb.org/t/p/w300" + posterPath
        var titleclass = "div."+i
        $(titleclass).last().text(title)
        $(titleclass).last().prepend('<img src=' + imgsrc + ' class="movieImg">')
      }
    }
function generateGenreSection ( genre_name , rank , response ) { console . log ( genre_name , rank , response ) $ ( '.genreResult' ) . first ( ) . show ( ) $ ( '.genreResult' ) . last ( ) . clone ( ) . appendTo ( '.result' ) $ ( '.genreResult' ) . first ( ) . hide ( ) $ ( '.genreTitle' ) . last ( ) . text ( ( genre_name ) . toUpperCase ( ) ) $ ( '.genreRank' ) . last ( ) . text ( "#" + rank ) $ ( '.header' ) . last ( ) . text ( "Top Movies for " + genre_name ) for ( var i = 0 ; i < 3 ; i ++ ) { var posterPath = response . results [ i ] . poster_path var title = response . results [ i ] . title var imgsrc = "https://image.tmdb.org/t/p/w300" + posterPath var titleclass = "div." + i $ ( titleclass ) . last ( ) . text ( title ) $ ( titleclass ) . last ( ) . prepend ( '<img src=' + imgsrc + ' class="movieImg">' ) } }
generate the section including rank and top movies in that genre
generate the section including rank and top movies in that genre