0
的jquery我有以下JSON数据填充下拉从使用JSON数据
{"Date Created":"date_entered","Date Modified":"date_modified","Description":"description"}
如何填充使用该JSON数据jQuery的下拉列表?
的jquery我有以下JSON数据填充下拉从使用JSON数据
{"Date Created":"date_entered","Date Modified":"date_modified","Description":"description"}
如何填充使用该JSON数据jQuery的下拉列表?
假设数据已经被解析到JavaScript对象,你需要循环对象键和构建HTML类似:
var html='<option value=""></option>';
for(key in data){
html += '<option value="' + data[key] + '">' + key + '</option>';
}
$('#mySelect').html(html);