-
-
Save Yogatopia/64be8a5c5227933a7adf to your computer and use it in GitHub Desktop.
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 count = 2; // How many photos do you wanna display | |
var igToken = "371393934.dba0291.7da640d4c8fc4ff3a205f2e290eae6f1"; // DON'T USE MY ACCESS TOKEN. Generate your own, http://instagram.com/developer | |
var igUserId = "371393934"; // This is easy to generate, I've made a thing http://themes.edada.ms/instagram-auth | |
$.ajax({ | |
url: 'https://api.instagram.com/v1/users/'+igUserId+'/media/recent/?access_token='+igToken+'&callback=?', | |
data: { | |
'count': count | |
}, | |
dataType: "jsonp", | |
success: function(returned){ | |
if(returned.meta.code !== 200){ | |
$('.instagram .photos').append('<span style="color:red">Instagram API Error: <code>'+returned.meta.error_message+'</code></span>'); | |
}else{ | |
for(i=0; i<returned.data.count; i++){ | |
$('.instagram .photos').append('<div class="photo"><a href="'+returned.data[i].link+'"><img src="' + returned.data[i].images.low_resolution.url + '" /></a></div>'); | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment