标签:order sel form .data UNC var vip sele console
layui下写入监听,
searchPname 是第一个下拉框
searchParkingname 是第二个下拉框
form.on(‘select(searchPname)‘, function(data){ $.getJSON(apiCtxPath + "/comuser/vipuser/userVipByParkingarea?parkingsvrId="+data.value, function(data){ var optionstring = ""; console.log(data); for (var i = 0; i < data.list.length; i++) { optionstring += "<option value=\"" + data.list[i].columns.u_parkingarea_id + "\" >" + data.list[i].columns.parkingname + "</option>"; } /* $.each(data.data, function(i,item){ }); */ $("#searchParkingname").html(‘<option value=""></option>‘ + optionstring); form.render(‘select‘); //这个很重要 }); });
下面是第二个下拉框html部分
<div class="form-group">
<label class="control-label" for="ordercode">停车场</label>
<select id="searchParkingname" name="searchParkingname" lay-filter="searchParkingname" lay-verify="required" lay-search="">
<option value="">直接选择或搜索选择</option>
<option value=""></option>
</select>
</div>
标签:order sel form .data UNC var vip sele console
原文地址:https://www.cnblogs.com/EzioSyh/p/9001845.html