Skip to content

Instantly share code, notes, and snippets.

@mstorino
Created October 16, 2017 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mstorino/377f3773376a93a4ead654355dcb6062 to your computer and use it in GitHub Desktop.
Save mstorino/377f3773376a93a4ead654355dcb6062 to your computer and use it in GitHub Desktop.
API / AJAX Overview
$(document).on("click", ".animal-button", function() {

var type = $(this).attr("data-type");
var queryURL = "http://api.giphy.com/v1/gifs/search?q=" + type + //API KEY & PARAMETERS THAT LIMIT RESPONSE DATA TO AMOUNT YOU WANT;
$.ajax({
  url: queryURL,
  method: "GET"
})
.done(function(response) {
  var results = response.data;
  console.log(results);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment