{
"formname": ["Myapname", {
"operation": ["add", {
"values": {
"confirm_code": "12345",
"ID": 222333333,
"user_id": "10000"
},
"status": "Success"
}]
}]
}
I have tried this below:
posting.done(function( data ) {
var obj = JSON.parse(data);
console.log(obj["ID"]);
});
});
But I am not getting back anything all I see undefined
can someone assist me with what am doing wrong
ID
is not a property of obj
, it's property of it's nested object. You can get it using obj.formname[1].operation[1].values.ID
var obj = { "formname": ["Myapname", { "operation": ["add", { "values": { "confirm_code": "12345", "ID": 222333333, "user_id": "10000" }, "status": "Success" }] }] }; console.log( obj.formname[1].operation[1].values.ID )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.