HTML and CSS Reference
In-Depth Information
}
else
{
//They must have entered a value, carry on with API call, first
display a loading message to notify the user of activity
$
(
'#poster'
).
html
(
"<h2 class='loading'>Your poster is on its
way!</h2>"
);
If the input contains a value, we then process the user's request. Another message is
displayed, letting the user know that something is happening.
$
.
getJSON
(
"http
:
//api.themoviedb.org/2.1/Movie.search/en/json/
23afca60ebf72f8d88cdcae2c4f31866/" + film + "?callback=?", function(json) {
//TMDb is nice enough to return a message if nothing was found,
so we can base our if statement on this information
if
(
json
!=
"Nothing found."
){
//Display the poster and a message announcing the result
$
(
'#poster'
).
html
(
'<h2 class="loading">Well, gee whiz! We
found you a poster, skip!</h2><img id="thePoster" src='
+
json
[
0
].
posters
[
0
].
image
.
url
+
' />'
);