Php Json获取数据值
我只需要获取id数据Php Json获取数据值,php,jquery,json,Php,Jquery,Json,我只需要获取id数据 {"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","co
{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}
需要进行jquery json解码吗
o/p:register.id
var jsondata='{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}';
var result=$.parseJSON(jsondata);
// OR
var result=JSON.parse(jsondata);
console.log(result.register.id); //result will be 1
请试试这个:
var obj ='{"register":{"id":"1","members_count":null,"name":"Neha","user_name":"Neha","email":"help.eduexpression.com@gmail.com","profileId":"8866","maritialstatus_id":"1","religion_id":"1","caste_id":null,"mothertongue_id":"4","employed_id":"6","country_id":"103"}}';
var json = JSON.parse(obj);
alert(json.register['id']);
请描述您的问题我想在jquery中解码上面的json对象可能的副本您使用ajax做什么