我找到了json url来实时显示分数
@H_502_2@http://json-cricket.appspot.com/score.json
json的输出:
@H_502_2@{ "batting_team": "Canada","date": "Feb 28,2011","match": "Canada vs Zimbabwe","score": "Canada 106-8 (37)","summary": "Z Surkari(21) H Baidwan(3)*" } @H_502_2@$.getJSON("http://json-cricket.appspot.com/score.json",function (data) { $.each(data,function (i,set) { alert("Batting Team: "+set.batting_team); }); });请提一下我做错了什么.我无法从json获取数据.我无法连接到该网站.
提前致谢
解决方法
你可能想做更像的事情:
@H_502_2@for(var item in data) {
alert(item + ':' + data[item]);
}
这会为您提供“batting_team:Canada”和“date:Feb 28,2011”等消息,这可能更符合您的需求.