I had found json url for live display of scores
http://json-cricket.appspot.com/score.json
Output of json:
开发者_StackOverflow{
"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);
});
});
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.
Thanks in advance
You probably mean to do something more like:
for(var item in data) {
alert(item + ':' + data[item]);
}
This gives you messages like "batting_team : Canada" and "date : Feb 28, 2011" which is probably more what you want.
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]);
}
});
精彩评论