I have json in the following format.
[{"custId":7,"emailId":"raju.allen1888@gmail.com","facebookId":"","twitterId":"","mobilePhone":"","landPhone":"","firstName":"Allen","lastName":""},{"custId":8,"emailId":"raju@gmail.com","facebookId":"","twitterId":"","mobilePhone":"","landPhone":"","firstName":"Emanuel","lastName":""}]
i have a dropdown list with all the keys, if i choose a key, for e.g emailId, i need to get the emailId from the json.
it works fine when i give like this,
for(i in data){
alert(data[i].emailId);
}
when i get the value from the dropdown in a variable and try to use it like the following its giving me error as undefined.
var key = $('#dropdownvalue').val(); //emailId as value from the dropdown
for(i in data){
alert(data[i].key);
}
how to solve this, to select the value for the key selected through dropdown.