Created
October 7, 2016 19:07
-
-
Save avand/a089844416f5bc0114f24d3ea868bd32 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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