javascript - Retrieve values from a JSON -
i want extract tenantid value below given json
{ "clientaccounts":{ "@tenantid":"entprisedemo", "clientaccount":[ { "guid":"447a0bac-51e0-4f5f-b504-97dca5825530", "totalvalueformatted":"$1,100,000" } ] } }
this javascript function calling ajax request , success function code
$.ajax({ url: "$clientaccountsurl", cache: false, datatype: "json", // set json or xml success: function(data){ alert(data.clientaccounts.tenantid); } });
when i'm alerting value of tenantid in success function it's returning me undefined value though checked on firebug available in json array.
is there way retrieve value of tenantid.
you should able access using associative array:
data.clientaccounts['@tenantid']
Comments
Post a Comment