Reputation: 383
I have following JSON Data
{"Date Created":"date_entered","Date Modified":"date_modified","Description":"description"}
How do I populate dropdown with jquery using this json data ?
Upvotes: 0
Views: 56
Reputation: 171679
Assuming data has already been parsed to javascript object, you need to loop over object keys and construct html something like:
var html='<option value=""></option>';
for(key in data){
html += '<option value="' + data[key] + '">' + key + '</option>';
}
$('#mySelect').html( html );
Upvotes: 1