I am receiving the following error though I don’t really know why: Uncaught TypeError: Cannot read property ‘id’ of undefined
Here is the code block that is throwing the error:
//get elseCount
$.ajax({
type: "GET",
dataType: "jsonp",
cache: false,
url: "https://api.instagram.com/v1/tags/crookedspaces/media/recent/?count=100&access_token=MYTOKEN",
success: function(data) {
confirm("Else Count running");
for (var e = 0; e < imageCount; e++) {
var igUID = data.data[e].user.id;
if(igUID !== "16741082") {
//confirm("Else count: " + elseCount + ".");
//console.log("Else portion of code ran " + elseCount + " time(s).");
++elseCount;
}
}
console.log("Else count:" + elseCount + ".");
}
});
It is getting data from different users
So use this data.data[0].user.id
If you want you can put the index in a loop, but first try the above it should work.
Also replace
Replace for (var e = 0; e < imageCount; e++) with