$.ajax({
url: 'https://api.imgur.com/3/album/' + sharedAlbumID,
type: 'GET',
beforeSend: function(xhr){xhr.setRequestHeader('Authorization', 'Client-ID '+imgurClientID);},
success: function(resp) {
var dataLink = 'http://i.imgur.com/' + resp.data.cover + '.jpg';
var url = encodeURI(window.location.href);
var media = encodeURI(dataLink);
$('#pinterestHolder').html('<a target="_blank" data-pin-config="beside" href="//pinterest.com/pin/create/button/?url=' + url + '&media=' + media + '&description=Imagedoku album recommendation: ' + resp.data.id + '" data-pin-do="buttonPin" ><img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" /></a>');
if (resp.data.images.length >= 9) {
for (var i = 0; i < 9; i++) {
var imgID = resp.data.images[i].id;
imgID += 't';
imgID = 'http://i.imgur.com/' + imgID + '.jpg';
$('#albumHolder').append('<div class="albumThumbHolder"><a href="' + resp.data.images[i].link + '" target="_blank"><img class="imguralbumthumb" title="' + resp.data.images[i].id + '" src="' + imgID + '" /></a></div>');
}
} else {
$('#insufficientImagesError').modal();
}
$('#albumLink').html('<a href="http://imgur.com/a/' + sharedAlbumID + '" target="_blank">View album on Imgur</a>');
},
error: function(resp) {
$('#imgurMalformedError').modal();
}
});
This code works as expected in Chrome but returns a
resp.data is undefined
error on
var dataLink = 'http://i.imgur.com/' + resp.data.cover + '.jpg';
This is with the Imgur API, as I'm sure you can tell. Somehow, the issue is with Firefox nto reading the data object sent in the jQuery callback. How can I fix this? I'm only interested in making this work in Webkit and Mozilla, and it works in Webkit--any hacky answer will be fine.