Reputation: 157
I'm passing in authorization headers elsewhere, so I've gotten past that problem. If I alert(data) I get an object[Object], but am at a loss as to how to extract the data from that object. Any help would be greatly appreciated! Thanks!
var albumAPI = "https://api.imgur.com/3/album/" + albumID + "/images";
$.ajax({
url: albumAPI,
type: 'GET',
dataType: 'json',
success: function(data) {
alert(data[0].link);
},
error: function() { console.log("ERRORZ"); },
beforeSend: setHeader
});
Upvotes: 2
Views: 1243
Reputation: 388316
If you look at the data, it contains a property called data
which is an array - so get the link to the first image
alert(data.data[0].link);
Upvotes: 2