I'm trying to access specific data from json array. and i'm using dynamic dropdown.
So in my case i want get all names from the json and plot it on option.
here is the Json we're accessing..
[
{
"id": 1,
"name": "john"
"age": 23,
"city": "New York"
},
{
"id": 2,
"name": "Donald"
"age": 34,
"city": "London"
},
{
"id": 3,
"name": "k'nan"
"age": 27,
"city": "Paris"
},
{
"id": 1,
"name": "jose"
"age": 29,
"city": "lesbon"
},
]
script
$.each(data, function(key,vlaue ){
$('select[name="bus_number"]').append('<option value="'+ key +'">'+ value +'</option>');
});
and again i want to access only all names and plot it on options. i did this and it's not working and may be you guys will tell me a better way.