Essentially what I'm doing is trying to pull in Twitter data for use in Javascript app. I have a php file which is calling the API and retrieving JSON data, but I can't seem to access this data within my javascript file.
I'm trying to use this method.
$.getJSON("tweets_JSON.php?count=1&callback=listTweets");
Then to test it I'm using...
console.log(listTweets[0].id_str);
This returns a message that listTweets isn't defined. I've tried removing the callback form the url and declaring it as
var listTweets = $.getJSON("tweets_JSON.php?count=1&callback=listTweets");
This seems to access the first object in the array, but then I get an error saying the object property I'm looking for (.id_str
) can't be found.