Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var aladdin = document.querySelector(".aladdin");
var terminator = document.querySelector(".terminator");
aladdin.addEventListener("click", getMovie);
terminator.addEventListener("click", getMovie);
// ...and so on for each movie
// One event handler to rule them all...
function getMovie(event) {
var clickedMovie = event.target;
var imdbID = clickedMovie.id;
var url = "http://omdbapi.com/?i=" + id;
$.get("http://omdbapi.com/?i=tt0103639", displayResults);
}
function displayResults(results) {
// Update the table...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment