HTML and CSS Reference
In-Depth Information
NOTE: If you would like to see all of the values in the Rotten Tomatoes
API result set, check out the API documentation at
earch .
Next, it will loop through the results and create movie models to be used within
the application, based on the data. It will then create the view for the results,
and then replace the contents of the search results div with the results HTML.
var app = app || {};
app.controller = app.controller || {};
app.controller.movies = function(){
* Shows the search results in the search results card
this.showSearchResults = function(rtresults){
* This is the Rotten Tomatoes API data.
* The following code will process the data
* returned and convert it to models
* that the application will understand.
* You could wrap these API calls into
* a separate library, but for now having
* them in the controller will suffice.
// First, create an empty array to hold the results
var results = [];
// Next, loop through the results from Rotten Tomatoes
for(var i = 0; i < rtresults.movies.length; i++){
var rtmovie = rtresults.movies[i];
// For every result you create a new movie object
var title = rtmovie.title || '', rtid =, posterframe =
rtmovie.posters.original || '', synopsis = rtmovie.synopsis || '';
results.push(new, rtid, posterframe, synopsis));
// Create the view using the data
var view = new app.view.movielist(results);
Search WWH ::

Custom Search