Last active
August 29, 2015 14:03
-
-
Save jasdev/f700514f0f1fed8d8433 to your computer and use it in GitHub Desktop.
Fetch top 5 Gallery Items from Imgur
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
$.ajax({ | |
url: "https://api.imgur.com/3/gallery/", | |
/* | |
Note: It's best to avoid placing your client-id in js, as it is exposed to the end-user. | |
To avoid this, you could proxy requests to your own server, which makes the request directly to imgur. | |
*/ | |
headers: {"Authorization": "Client-ID YOUR_CLIENT_ID"}, | |
success: function(data) { | |
for(var i = 0; i < 5; i++){ | |
console.log(data['data'][i]['link']); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See our Gallery Endpoint for more options on how to sort results, paginate, etc.