jQuery getJSON在URL上不起作用

jQuery getJSON在URL上不起作用

问题描述:

我找到了可实时显示乐谱的json网址

I had found json url for live display of scores

http://json-cricket.appspot.com/score.json

json的输出:

{
 "batting_team": "Canada", "date": "Feb 28, 2011",
 "match": "Canada vs Zimbabwe", "score": "Canada 106-8 (37)",
 "summary": "Z Surkari(21) H Baidwan(3)*" 
}

我不知道如何使用以下代码在我的网站中获取和显示数据:

I don't know how to fetch and display the data in my site I am using following codes:

$.getJSON("http://json-cricket.appspot.com/score.json", function (data) {
    $.each(data, function (i, set) {
        alert("Batting Team: "+set.batting_team);
    });
});

请提及我我做错了什么.我无法从json获取数据.我无法连接到该站点.

Please mention me what wrong I did. I can't get the data from json. I am not being able to connect to the site.

预先感谢

嘿,我使用此方法获取了板球得分,

Hey I Fetched cricket score using this,

var url="http://json-cricket.appspot.com/score.json?callback=?";
$.getJSON(url, function (data) {
    for(var item in data) {
        alert(item + ':' + data[item]);
    }
});