xiaoguotu

 <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{

                        }
                    }
                });
            },
posted on 2022-03-30 12:27  depressiom  阅读(642)  评论(0编辑  收藏  举报