后台传来一个json,遍历获取到一个option字符串,现在怎么往select里面添加option,求大神指点
$(function(){$.post("get/cartype",function(data){varresult="";for(vari=0;i<data.lengt...
$(function(){
$.post("get/cartype",function(data){
var result = "";
for (var i = 0; i < data.length; i++) {
alert(data[i].name)
result += "<option value = '"+data[i].name+"'>"+data[i].name+"</option>";
}
$("#selectcartype").???(result) 展开
$.post("get/cartype",function(data){
var result = "";
for (var i = 0; i < data.length; i++) {
alert(data[i].name)
result += "<option value = '"+data[i].name+"'>"+data[i].name+"</option>";
}
$("#selectcartype").???(result) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询