I have a json data in following format
{"Jack":["[email protected]","US"],"Rob":["[email protected]","UK"]}
i have a select tag, if the value selected from a select box equal to "Jack" then it should print the data "[email protected]","US"
select box on change function is
function printDataOf(val){
now if selectd value is Jack
alert() // should alert [email protected]
alert() // should alert US
how do i do it?
alert(data[val][0])alert(json_obj[Jack][0]);instead ofalert(json_obj["Jack"][0]);. You're right.