function htDate(selectCustomerId, val) { var customerId = selectCustomerId; var values = val; ajaxJson('GET', webroot + "/customer/getOptionList", '', function(err, rsp) { if (rsp.code == 200) { var text = rsp.result; customerId.select2({ placeholder: "请选择客户", allowClear: true, language: "zh-CN", width: '410px' // data:text, }); //绑定Ajax的内容 customerId.empty(); //清空下拉框 $.each(text, function(i, item) { customerId.append("<option value='" + item.id + "'> " + item.name + "</option>"); }); /*设置默认值*/ $(customerId).val(values); } else { // hint(rsp.message); console.log(rsp); } }) } //使用 var customer = $("#customerId"); var val = data.customerId; htDate(customer, val);
如对本文有疑问, 点击进行留言回复!!
offset、client、scroll (width,height、left,top、X,Y)
网友评论