<div class="form-group">
<div class="row">
<div class="col-md-2"><label>省:</label></div>
<div class="col-md-4">
<select class="form-control" id="province2" name="proid" onchange="initCity(this.value)"></select>
</div>
<div class="col-md-2"><label>市:</label></div>
<div class="col-md-4">
<select class="form-control" id="city2" name="cityid"></select>
</div>
</div>
</div>
function initPro(){
$.ajax({
url:"<%=path%>/student/findArea.do",
type:"get",
async:false,//同步
data:{pid:0},
success:function(data){
var str="<option value='-1'>请选择</option>";
for(var i=0;i<data.length;i++){
str+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";
}
$("#province2").html(str);
}
})
}
//加载市的下拉列表
function initCity(pid){
$.ajax({
url:"<%=path%>/student/findArea.do",
type:"get",
async:false,//同步
data:{pid:pid},
success:function(data){
var str="<option value='-1'>请选择</option>";
for(var i=0;i<data.length;i++){
str+="<option value='"+data[i].id+"'>"+data[i].name+"</option>";
}
$("#city2").html(str);
}
})
}