app.js
@@ -1,6 +1,2030 @@
-app.js
+$(document).ready(function() %7B%0A  // findMeMovies();%0A  // findMovieDetails('tt0295297');%0A  $('form').on('submit', function(e) %7B%0A    e.preventDefault();%0A    findMeMovies();%0A  %7D);%0A%0A  $('table').hide();%0A  $('#details').hide();%0A%0A  $('body').on('click', 'a', function(e) %7B%0A    e.preventDefault();%0A    var imdbId = $(this).attr('href');%0A    findMovieDetails(imdbId);%0A  %7D);%0A%0A%7D);%0A%0A%0Afunction getSearchTitle() %7B%0A  return $('form %3E input%5Btype=%22text%22%5D:nth-child(1)')%5B0%5D.value;%0A%7D;%0A%0Afunction populateMovieList(response) %7B%0A  $('table').html('%3Ctr%3E%3Cth%3EMovie%3C/th%3E%3Cth%3EType%3C/th%3E%3Cth%3EYear%3C/th%3E%3C/tr%3E');%0A  response.Search.forEach(function(movie) %7B%0A    $('table').append('%3Ctr%3E%3Ctd%3E %3Ca href=%22' + movie.imdbID + '%22%3E' + movie.Title +%0A      '%3C/a%3E %3C/td%3E%3Ctd%3E' + movie.Type + '%3C/td%3E%3Ctd%3E' + movie.Year + '%3C/td%3E%3C/tr%3E');%0A  %7D);%0A  $('table').show();%0A  $('#details').hide();%0A%7D;%0A%0Afunction populateMovieDetails(response) %7B%0A  $('#details').html(%22%22);%0A  $('#details').append('%3Ch3%3E %3Cspan%3E ' + response.Title + '%3C/span%3E %3Cspan%3E' +%0A    response.Released + '%3C/span%3E%3C/h3%3E %3Ch4%3ERated:' +%0A    response.Rated + '%3C/h4%3E%3Cp%3EPlot:' + response.Plot +%0A    '%3C/p%3E%3Cimg class=%22poster%22 src=%22' +%0A    response.Poster + '%22%3E%3Cdiv class=%22movie-stuff%22 %3E%3Cp%3ERating: ' +%0A    response.imdbRating + '%3C/p%3E%3Cp%3ECast: ' +%0A    response.Actors + '%3C/p%3E%3Cp%3EGenre: ' +%0A    response.Genre + '%3C/p%3E%3C/div%3E');%0A  $('#details').show();%0A  $(%22html, body%22).animate(%7B%0A    scrollTop: $('#details').offset().top%0A  %7D, 1000);%0A%0A%7D%0A%0Afunction findMeMovies() %7B%0A  var apiCall = %22http://www.omdbapi.com/?s=%22 + getSearchTitle() + %22&r=json%22;%0A%0A  $.ajax(%7B%0A    url: apiCall,%0A    method: 'GET'%0A  %7D).done(function(response) %7B%0A    populateMovieList(response);%0A  %7D).fail(function() %7B%0A    alert('Sorry! No donut for you!');%0A  %7D);%0A%7D;%0A%0Afunction findMovieDetails(id) %7B%0A  var apiCall = %22http://www.omdbapi.com/?i=%22 + id + %22&plot=full&r=json%22;%0A%0A  $.ajax(%7B%0A    url: apiCall,%0A    method: 'GET'%0A  %7D).done(function(response) %7B%0A    console.log(response);%0A    populateMovieDetails(response);%0A  %7D).fail(function() %7B%0A    alert('Sorry! No donut for you!');%0A  %7D);%0A%7D;%0A

update app.js