<div class="right_left">
<select id="supply">
<option>请选择供应商</option>
</select>
<svg class="icon" aria-hidden="true" style="width: 15px;height: 15px;">
<use xlink:href="#iconqianwang_iocn1"></use>
</svg>
</div>
js
//获取供应商的值
getSupply(){
$.ajax({
type : "post",
url : "服务器地址",
async : true,
data : {
'userkey' : self.userkey,
'uniqueid' : self.uniqueid
},
dataType : 'json',
success : function(msg) {
if (msg.status == 1) {
this.supplyArray = msg.result;
/** 设置供应商的值 */
if(this.supplyArray.length){
$("#supply").empty(); //清空
for(var i = 0 ; i<this.supplyArray.length;i++){
$("#supply").append("<option value=" + this.supplyArray[i].id + ">" + this.supplyArray[i].name + "</option>"); //动态添加标签
}
}
}else{
}
}
});
},
本文来自博客园,作者:depressiom,转载请注明原文链接:https://www.cnblogs.com/depressiom/p/16076444.html