JavaScript代码:
$(document).ready(function () {
getIntype();
});function getIntype(){
$.ajax({
type:"post",
dataType:"json",
url:"http://192.168.35.111:8080/officeSystem/InstorageCheckIn/getInstorageType.do", success:function(data){
var len=data.length;
for(var i=0;i<len;i++){
var option=document.createElement("option");
$("#selectIn").append(('<option value='+data[i].id+'>'+data[i].name+'</option>'));
}
},
error:function(data){
console.log(data);
}
});
}
HTML代码:
入库类型是:
<select id="selectIn" onchange="goUrl(this.options[this.selectedIndex])">
<!--<option value="0">请选择</option>-->
<!--<option value="comAdmin_in_purchase.html">采购</option>-->
<!--<option value="comAdmin_in_return.html">归还</option>-->
<!--<option value="comAdmin_in_gain.html">受赠</option>-->
</select>
执行结果: