Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// Assuming there's an <img class="aladdin"> on the page...
var aladdin = document.querySelector(".aladdin");
aladdin.addEventListener("click", getAladdin);
// You'll have multiple event handlers...
function getAladdin(event) {
$.get("http://omdbapi.com/?i=tt0103639", displayResults);
}
// ...but only one AJAX callback
function displayResults(results) {
// Update the table...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment