可能重复:
I have a nested data structure / JSON, how can I access a specific value?
我的Json回复如下:
[{"referenceid":"999","firstname":"Firstname","middlename":"Middlename","lastname":"Surname","shortlisted":"0"}]
如何检索referenceid值?我搜索过并搜索过...尝试了各种各样的事情,但我只能返回“未定义”。
由于
编辑:
忘记我的其他代码: -
function populateFormData() {
var mxKey = $.now();
$.get("\\web\\php\\somesite\\phpData.php?mxKey" + mxKey, function(applicationData) {
console.log("Application Data: " + applicationData);
var jsonData = JSON.parse(applicationData);
console.log("Json Parse Data: " + jsonData);
});
}
答案 0 :(得分:3)
var a = [{
"referenceid": "999",
"firstname": "Firstname",
"middlename": "Middlename",
"lastname": "Surname",
"shortlisted": "0"
}];
alert(a[0].referenceid);