HTML and CSS Reference
In-Depth Information
...
this.search = function(query){
// Check to see whether the query length is longer than 0 characters
if(query.length > 0){
/*
* Encode the query so that it can be passed
* through the URL
*/
query = encodeURIComponent(query);
/**
* Create a new JSONP request
*/
var jsonp = new app.utility.jsonp(
' http://api.rottentomatoes.com/api/public/v1.0/movies.json?apikey=
YOURAPIKEY&q=' + query, 'app.bootstrap.getController(
"movies").showSearchResults');
/**
* Send the request
*/
jsonp.send();
/**
* Add the loading class to the search field
*/
_searchfield.classList.add('loading');
}
}
...
}
You will need to replace YOURAPIKEY in the JSONP request URI with your API key
for Rotten Tomatoes. As you can see, you use the bootstrap to get the movies
controller and execute the showSearchResults after the results have loaded.
Showing the Results
The showSearchResults action/event accepts a Rotten Tomatoes result set.
 
Search WWH ::




Custom Search