JS
fromFactory8Storehouse1:function(e){
var fromFactory8Code = $('#fromFactory8Code').val();
// var data = getStorehouse(fromFactory8Code);
if(fromFactory8Code==""){
return;
}
$.ajax({
url:"getFactory8Storehouse",
type:"post",
async:false,
dataType:"text",
drag:false,
data:{
"factory8Code":fromFactory8Code
},
success:function(data){
if(data.indexOf("noData")<0){
var dataArray = data.substring(1,data.length-1).split(",");
$('#fromStorehouselist').children("li").remove();
$('#fromStorehouseSelect').text("请选择库位");
$('#fromStorehouse').val("");
$('#fromStorehouselist').append("<li data-code='0'>请选择库位</li>");
$.each(dataArray,function(index,item){
$('#fromStorehouselist').append("<li data-code='"+item+"'>"+item+"</li>");
});
}else{
$('#fromStorehouselist').children("li").remove();
$('#fromStorehouseSelect').text("请选择库位");
$('#fromStorehouse').val("");
$('#fromStorehouselist').append("<li data-code='0'>请选择库位</li>");
alert('您所填入的调出工厂:'+fromFactory8Code+'不存在!');
return;
}
},
error: function(){
}
});
}
页面
<div class="Q-select Q-search-s">
<div id="fromStorehouseSelect" class="P-select-btn radus-s" style="width:100px; text-align:left; overflow:hidden;">请选择库位</div>
<div class="P-select-list radus-s" style="width:110px;height:150px; overflow:auto;">
<ul id="fromStorehouselist">
<li data-code="">请选择库位</li>
</ul>
</div>
<input type="hidden" name="fromStorehouse" id="fromStorehouse" class="text radus-s" value="" />
</div>