-
-
Save outoftime/34ed09c8b6e4aa32e0e498e0b088c68e to your computer and use it in GitHub Desktop.
Exported from Popcode.
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Page Title</title> | |
</head> | |
<body> | |
<div> | |
<input id="query" placeholder="Enter your search term"> | |
<input type="submit" id="submit" value="Search"> | |
</div> | |
<div id="output"></div> | |
<script type="text/template" id="template"> | |
{{#gifs}} | |
<div> | |
<img src="{{images.original.url}}"> | |
</div> | |
{{/gifs}} | |
</script> | |
</body> | |
</html> |
This file contains hidden or 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
var API_KEY = "dc6zaTOxFJmzC"; | |
var template = $('#template').html(); | |
$("#submit").click(function() { | |
var url = "https://api.giphy.com/v1/gifs/search?q=" + encodeURIComponent($("#query").val()) + "&api_key=" + API_KEY; | |
$.get(url).then(function(response) { | |
$('#output').html(Mustache.render(template, {gifs: response.data})); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment