我正在使用 Scoreoid 平台来实现排行榜。以下是我的 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,
任何帮助将不胜感激,我敢肯定这是我缺少的一些简单的东西。谢谢你。