Last active
December 25, 2015 22:09
-
-
Save garrettwilkin/7047297 to your computer and use it in GitHub Desktop.
When I click the "Fly!" button, I see the console.log output. Not so with the "Go!" button. What gives?
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
JS: | |
// Callback to populate recommendations div. | |
callback = function(data) { | |
recDiv.html(""); | |
$.each(data.data, function(i, datum) { | |
var thumb = "<div class='thumb'><img src='" + datum.thumb_url_medium + "'></div>", | |
title = "<div class='title'>" + datum.title + "</div>" | |
recDiv.append("<div class='post'>"+title+thumb+"</div>"); | |
}); | |
}; | |
function click(url,callback) { | |
console.log("clicked"); | |
$.getJSON(url, callback); | |
} | |
function srsly() { console.log("I know, right?!");} | |
Buttons: | |
<button type="button" class="btn btn-default" onClick="click(url,callback)">Go!</button> | |
<button type="button" class="btn btn-default" onClick="srsly()">Fly!</button> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment