将json元素添加到表单select中
将json元素添加到表单select中。
$.ajax({type: "GET",
url: "ajax_get_districts.php",
data: "type=operators&project_id="+o.options[o.selectedIndex].value,
dataType: "json",
success: function(json){
for(var i = 0; i < json.length; i++)
{
$(new Option(json[i].name,json[i].id)).appendTo('#select_project');
}
}
});