全国省市县区街道 无联动下拉选择
程序员文章站
2022-04-30 17:07:59
...
全国省市县区街道 无联动下拉选择 数据库及源代码
前端JQ代码
引入jq库
前端JQ代码
引入jq库
html代码
thinkphp代码//读取省数据库
public function region(){
$provinces=M('Position_provice')->select();
$provinces_json = json_encode($provinces);
exit($provinces_json);
}
//读取市数据库
public function regioncity(){
$where['province_id']=$_GET['province_id'];
$provinces=M('Position_city')->where($where)->select();
$provinces_city = json_encode($provinces);
exit($provinces_city);
}
//读取省/区数据库
public function regioncounty(){
$where['city_id']=$_GET['city_id'];
$provinces=M('Position_county')->where($where)->select();
$provinces_county = json_encode($provinces);
exit($provinces_county);
}
//读取街道数据库
public function regiontown(){
$where['county_id']=$_GET['county_id'];
$provinces=M('Position_town')->where($where)->select();
$provinces_town = json_encode($provinces);
exit($provinces_town);
}
//读取社区数据库
public function regionvillage(){
$where['town_id']=$_GET['town_id'];
$provinces=M('Position_village')->where($where)->select();
$provinces_village = json_encode($provinces);
exit($provinces_village);
}
数据库http://blog.jjonline.cn/soft/J_Position/ajing.sql.gz AD:真正免费,域名+虚机+企业邮箱=0元
上一篇: thinkPHP和ajax实现的省市县区三级联动地址的请求方法
下一篇: 《马云点评创业》读书笔记