问题:对于给定的查询,我尝试从twitter api结果中解析json。解析json的jquery的getJSON for twitter api搜索结果不起作用
代码在:http://jsfiddle.net/Nstnx/176/
问题:对于给定的查询,我尝试从twitter api结果中解析json。解析json的jquery的getJSON for twitter api搜索结果不起作用
代码在:http://jsfiddle.net/Nstnx/176/
我对这个waaaay后面,cwallenpoole应该得到应有的任何信贷很多更快,但这里有一个工作演示 -
数据参数具有results
属性。你要遍历该而不是通过直接的数据:
这
$.each(data, function(index, item) {
应该
$.each(data.results, function(index, item) {
试试这个
var url = "http://search.twitter.com/search.json?callback=?&rpp=50&q='ramlila'";
$.getJSON(url, function(data) {
var items = [];
var twitterList = $("<ul />");
$.each(data.results, function(index, item) {
alert(data.results[index].text);
$("<li />", { "text" : item.from_user})
.appendTo(twitterList);
});
$("#output").fadeOut("fast", function(){
$(this).empty()
.append(twitterList)
.fadeIn("slow");
});
});
你为什么做两个请求的网址是什么? – gislikonrad
对不起,对于错字。 – whatf