下拉框选中的事件

$(document).on('change','#citys_id',function () {
var id = $('#citys_id').val(); // 城市ID
var country_id = $('#quanpost-country_id').val();
var _this = $("#university_id");
$.ajax({
url: "/quan/post/university-id",
data: {
id: id,
country_id: country_id,
},
method: 'get',
success: function (data) {
_this.empty(); //清空上次的内容
_this.append(data) // 把返回来的所有大学名字,插入<select id='university_id'></selcet>
},
error: function () {
alert("请求发生错误");
}
})
})

posted on 2018-11-02 10:59  刷哥  阅读(974)  评论(0编辑  收藏  举报

导航