$.post('ol_st_checker.php',function(d){ //this method is going to check who ever is online
$.each(d.uinfo,function(index,value) {
alert(index+'='+value);
/*$.each(this,function(index, element) {
alert(index+'='+element);
});*/
});
},'json');},
使用PHP json_encode发送到浏览器的数据如下所示:
[{"uinfo":{"0":"1","status":"1","1":"1001","user_id":"1001","2":"2013-05-09 22:24:10","last_update":"2013-05-09 22:24:10"}}]
在警告框中,我收到“未定义”,但是当我尝试在post函数后显示警告时,我得到了上面的输出。
答案 0 :(得分:0)
试试这个
d
是一个数组。 d[0].uinfo
是您尝试访问的对象。
$.post('ol_st_checker.php',function(d){ //this method is going to check who ever is online
$.each(d[0].uinfo,function(index,value) {
alert(index+'='+value);
/*$.each(this,function(index, element) {
alert(index+'='+element);
});*/
});
},'json');},