jQuery - Parse Json then Display Data -
i'm having problem parsing valid json twitter list displaying list on page.
here code;
var url = "http://api.twitter.com/1/aplusk/lists/5676047/statuses.json&callback=?"; $.getjson(url, function(data) { var results = ''; $(data.results).each(function() { results += "<p class='tweet_result' id='tweet" + this.id_str + "'><a href='http://twitter.com/" + this.user.screen_name + "' title='' class='tweet_user'></p>"; }); $(results).prependto("#twitter_results"); });
if put url in www.jslint.com can view structure of json
i'm new json doing stupid here.
thanks in advance , advice.
the url has be:
http://api.twitter.com/1/aplusk/lists/5676047/statuses.json?callback=?
(note question mark instead of ampersand)
also see returned object, does'nt have member "results", it's native javascript-array.
you'll have iterate on data itself:
$(data).each(function(i,item)
where can access properties inside via
item.someproperty
Comments
Post a Comment