嗨,我有以下代码:。每个解析JSON返回undefined
$.ajax({'type':'POST', 'url':'https://www.123.com/site/gethistory',
'data':{'a': this.username, 'b': username},
'success':function(history){
alert(history);
var codes = jQuery.parseJSON(history);
$.each(codes, function(key, value) {
alert(key);
}); //each
},
'error':function(){
}
}); //ajax
眼下的关键是不确定的。而我试图提醒(value.text),它仍然给我未定义。
历史警觉,因为这:
[{ “演示”:{ “文”: “喜 人”, “时间”: “1380167419”}, “管理员”:{ “text”:“hi”,“time”:“1380167435”},“demo”:{“text”:“this works flawless now。”,“time”:“1380167436”},文 “:” 我们正在 基本上是与这个工作/”, “时间”: “1380167443”}}]
jquey版本用过吗? –
@ArunPJohny 1.7.1 – jackhao
你打开控制台并检查parseJSON是否抛出错误? – adeneo