标签:省份 content getx style ict charset comm json .text
function ShengList() { //alert("准备展示省份并调用市"); $.ajax({ url: ‘/City/GetProvcnList‘, dataType: ‘json‘, contentType: ‘application/json;charset=utf-8‘, success: function (data) { var ProvcnStr = ""; $("#CityAreaIds").html(""); $.each(data, function (i, o) { ProvcnStr += ‘<option>‘ + o.provcn + ‘</option>‘; }); $("#CityAreaIds").html(ProvcnStr); ShiList($("#CityAreaIds").find("option:selected").text()); } }); }; function ShiList(provcn) { //alert("准备展示市区并调用县"); $.ajax({ data: { "provcn": provcn }, url: ‘/City/GetCitylist‘, dataType: ‘json‘, contentType: ‘application/json;charset=utf-8‘, success: function (data) { var districtcnStr = ""; $("#City").html(""); $.each(data, function (i, o) { districtcnStr += ‘<option>‘ + o.districtcn + ‘</option>‘; }); $("#City").html(districtcnStr); XianList($("#City").find("option:selected").text()); } }); }; function XianList(districtcn) { //alert("准备展示县区"); $.ajax({ data: { "districtcn": districtcn }, url: ‘/City/GetXanlist‘, dataType: ‘json‘, contentType: ‘application/json;charset=utf-8‘, success: function (data) { var namecnStr = ""; $("#CityAreaId").html(""); $.each(data, function (i, o) { namecnStr += ‘<option value=‘ + o.areaid + ‘ >‘ + o.namecn + ‘</option>‘; }); $("#CityAreaId").html(namecnStr); judge($(‘#CityAreaId option:selected‘).val()); //getXhpro($(‘#CityAreaId option:selected‘).val()); } }); }; function judge(CityAreaId) {//根据县查询所有的小区 $.ajax({ url: ‘/City/GetVillagnamelist‘, dataType: ‘json‘, data: { "city_areaid": CityAreaId }, contentType: ‘application/json;charset=utf-8‘, success: function (data) { var xiaoquStr = ""; $("#Community").html(""); $.each(data, function (i, o) { xiaoquStr += ‘<option value=‘ + o.id + ‘>‘ + o.name + ‘</option>‘; }); $("#Community").html(xiaoquStr); } }); }; $(function () { ShengList(); $("#CityAreaIds").change(function () { ShiList($(this).val()); }); $("#City").change(function () { XianList($(‘#City option:selected‘).text()); }); $("#CityAreaId").change(function () { judge($(‘#CityAreaId option:selected‘).val()); getXhpro($(this).val()); }); });
标签:省份 content getx style ict charset comm json .text
原文地址:http://www.cnblogs.com/wc918/p/6855958.html