0
我正在使用Scoreoid平台来实现排行榜。以下是我的JSON响应:JSON输出排行榜
[{
"Player": {
"username": "TestPlayer",
"email": "",
"first_name": "",
"last_name": "",
"platform": ""
},
"Score": {
"score": "23",
"created": "2012-07-13 22:06:46",
"difficulty": "0",
"platform": ""
}
}]
尝试这个JSON格式为DIV,这个(其中还包含我的电话):
$(document).ready(function(){
$.post('scoreoid_proxy.php', {action:'curl_request', method:'getScores', response:'JSON'},
function(data) {
$.each(data.Player, function(i,Player){
content = '<p>' + Player.username + '</p>';
content += '<br/>';
$(content).appendTo("#response");
});
});
});
不过,我收到以下错误:
object is undefined
length = object.length,
任何帮助将不胜感激,我敢肯定,这是简单的我很想念。谢谢。
嗨火箭,谢谢。我现在变得“玩家未定义”。 – Elisabeth 2012-07-16 15:50:07
@伊丽莎白:检查我添加到答案的编辑。你的JSON可能没有被解析。 – 2012-07-16 15:54:51
你真棒。那样做了。谢谢! – Elisabeth 2012-07-16 16:15:44