赞
踩
1、\'counties':String($('#counties').val()),
2、toString()
原因描述: alert(
citiesData )是有值的,在 action里面 接收到的就是null,原因是我用了
<link rel="stylesheet"
href="<%=path%>/multiple-select/bootstrap/css/bootstrap.css" />
<link rel="stylesheet"
href="<%=path%>/multiple-select/multiple-select.css" />
<script src="<%=path%>/multiple-select/multiple-select.js"></script>
multiple-select.css,数据值类型 不太匹配,需要转成string。
代码:
var citiesData = $("#cities").val().toString();
alert("1:"+citiesData);
if(citiesData!= undefined &&citiesData!=""){
$.ajax({
type: 'POST',
datatype:'json',
data: {"citiesData":citiesData
},
url: '<%=path%>/rpms/OurPartnerListAction/getPartnerCounties.do',
success:function(data){
var num=0;
$(data).each(function(i,obj){
num++;
$('#counties').append("<option value='"+obj.countyCode+"'>"+obj.areaName+"</option>");
});
if(num<=1){
$('#counties').attr("disabled","disabled");
}
$('##counties').change(function(){
alert("改变了乡");
// console.log($(this).val());
}).multipleSelect({
width:'100px'
});
},
error: function(result){
keyan.ajaxRespMsg(result);
}
});
解决方法:
1、counties':String($('#counties').val()),
2、
counties':$('#counties').val(),toString()
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。