Last active
July 15, 2017 09:01
-
-
Save dope/0c6f27e4dbc5c46692387d72f9b9bfc2 to your computer and use it in GitHub Desktop.
Pure JS stab at Dribbble API
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 user = 'dope'; | |
var limit = 9; | |
var accessToken = 'TOKEN'; | |
var dribbble = new XMLHttpRequest(); | |
dribbble.responseJSON = null; | |
dribbble.open('GET', 'https://api.dribbble.com/v1/users/'+user+'/shots?access_token='+accessToken, true); | |
dribbble.onload = function() { | |
if (dribbble.status >= 200 && dribbble.status < 400) { | |
dribbble.responseJSON = JSON.parse(dribbble.responseText); | |
var shots = dribbble.responseJSON; | |
shotImages = "<img src="+ shots[0].images.hidpi +">"; | |
document.getElementById('dribbble').innerHTML += shotImages; | |
} | |
}; | |
dribbble.send(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment