Skip to content

Instantly share code, notes, and snippets.

@dope
Last active July 15, 2017 09:01
Show Gist options
  • Save dope/0c6f27e4dbc5c46692387d72f9b9bfc2 to your computer and use it in GitHub Desktop.
Save dope/0c6f27e4dbc5c46692387d72f9b9bfc2 to your computer and use it in GitHub Desktop.
Pure JS stab at Dribbble API
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