$(document).ready(function() {
$('form#search').bind("submit", function(e){
e.preventDefault();
$('#content').html('');
// Define the callback function
function getGeo(jsonData) {
$('#content').append(''+jsonData.rank+'跨域JSON響應失敗
');
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":[]
}
IM從URL
http://twittercounter.com/api/?username=Anand_Dasgupta&output=json&results=3&callback=getGeo
獲取JSON數據但是這段代碼似乎不起作用。 如果有人能夠以某種方式拋光代碼或提供任何迴應,將不勝感激。 謝謝
我同意。就是說,在我看來,這個錯誤。 – Boldewyn 2009-07-02 12:47:40
我以前試過使用getJSON,並且失敗了。它似乎沒有顯示任何東西。 Il嘗試移動getGeo功能並檢查。 – anand 2009-07-02 13:02:37