Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jquery解析Json-未获取值_Javascript_Jquery_Json - Fatal编程技术网

Javascript 使用jquery解析Json-未获取值

Javascript 使用jquery解析Json-未获取值,javascript,jquery,json,Javascript,Jquery,Json,我从服务器获取以下值 {"status":{"message":"success","code":200},"data":[{"sent":"test","category":"Appo","experience_time":"2014-10-07","sent_id":4501922,"categoryId":4011,"score":"Negative","feature":"emp","op":"challenges"}]} 我需要获得发送值、类别、经验时间、发送id、分数、功能、op等

我从服务器获取以下值

{"status":{"message":"success","code":200},"data":[{"sent":"test","category":"Appo","experience_time":"2014-10-07","sent_id":4501922,"categoryId":4011,"score":"Negative","feature":"emp","op":"challenges"}]}
我需要获得发送值、类别、经验时间、发送id、分数、功能、op等

到目前为止,我已经试过了。但是没有得到任何价值

 var result = jQuery.parseJSON(data);

          $.each(result, function(index, value) {

alert(value.score);

        });
试试这个

var jsonString='{“状态”:{“消息”:“成功”,“代码”:200},“数据”:[{“发送”:“测试”,“类别”:“Appo”,“经验时间”:“2014-10-07”,“发送id”:4501922,“类别id”:4011,“分数”:“负面”,“特征”:“emp”,“op”:“挑战”});
var result=jQuery.parseJSON(jsonString);
$.each(结果、数据、函数(索引、值){
警报(值、分数);
});

您需要使用
$.each(result.data,function(index,value){})
因为
result.data
包含要迭代的数组,所以在调用
jQuery.parseJSON(data)
之前,请确保
data
是字符串而不是对象-检查浏览器控制台是否有任何错误?尝试此操作,发出警报(data['score']);