Question

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
});
Was it helpful?

Solution

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top