【发布时间】:2010-11-07 14:59:06
【问题描述】:
$(document).ready(function() {
$('form#search').bind("submit", function(e){
e.preventDefault();
$('#content').html('');
// Define the callback function
function getGeo(jsonData) {
$('#content').append(''+jsonData.rank+'
');
bObj.removeScriptTag();
}
// The web service call
var req = 'http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3&callback=getGeo';
// Create a new request object
bObj = new JSONscriptRequest(req);
// Build the dynamic script tag
bObj.buildScriptTag();
// Add the script tag to the page
bObj.addScriptTag();
});
});
我尝试使用跨域json请求来获取json数据
{
"user_id":"3190399",
"user_name":"Anand_Dasgupta",
"followers_current":"86",
"date_updated":"2009-06-04",
"url":"",
"avatar":"205659924\/DSC09920_normal.JPG",
"follow_days":"0","started_followers":"86",
"growth_since":0,
"average_growth":"0",
"tomorrow":"86",
"next_month":"86",
"followers_yesterday":"86",
"rank":176184,
"followers_2w_ago":null,
"growth_since_2w":86,
"average_growth_2w":"6",
"tomorrow_2w":"92",
"next_month_2w":"266",
"followersperdate":[]
}
我从 url 获取 json 数据
http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3&callback=getGeo
但是这段代码似乎不起作用。 如果有人可以以某种方式完善代码或提供任何响应,将不胜感激。 谢谢你
【问题讨论】: