function Shenglist () {//alert ("Prepare to display the province and call the city");$.ajax ({URL:'/city/getprovcnlist', DataType:'JSON', ContentType:'Application/json;charset=utf-8', Success:function (data) {varProvcnstr =""; $("#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 ("Ready to show downtown and call County");$.ajax ({data: {"PROVCN": PROVCN}, URL:'/city/getcitylist', DataType:'JSON', ContentType:'Application/json;charset=utf-8', Success:function (data) {varDistrictcnstr =""; $("#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 ("Ready to show County area");$.ajax ({data: {"DISTRICTCN": DISTRICTCN}, URL:'/city/getxanlist', DataType:'JSON', ContentType:'Application/json;charset=utf-8', Success:function (data) {varNamecnstr =""; $("#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) {//according to the county to find all the Community$.ajax ({URL:'/city/getvillagnamelist', DataType:'JSON', data: {"City_areaid": Cityareaid}, ContentType:'Application/json;charset=utf-8', Success:function (data) {varXiaoqustr =""; $("#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 ()); });});
JS Provincial and County community linkage