<script type="text/javascript">
$(document).ready(function(){
$("#province").change(function(){
var value=$("#province").val();
//alert (value);
htmlobj=$.ajax({url:"__PUBLIC__/php/city.php",async:false,data:
{value:value}});
$("#city").html(htmlobj.responseText);
});
});
$(document).ready(function(){
$("#city").change(function(){
var value=$("#city").val();
//alert (value);
htmlobj=$.ajax({url:"__PUBLIC__/php/district.php",async:false,data:
{value:value}});
$("#district").html(htmlobj.responseText);
});
});
</script>
city
district
<?php
header("Content-type: text/html; charset= utf-8");
$con = mysql_connect("localhost","root","root");
if (!$con)
{
die(‘Could not connect: ‘ . mysql_error());
}
mysql_query("SET NAMES ‘UTF8‘");
mysql_select_db("hn", $con);
$result = mysql_query("SELECT * FROM xp_sys_city where ProvinceID = ".$_GET[‘value‘]);
while($row = mysql_fetch_array($result))
{
echo "<option value=‘".$row[‘ID‘]."‘>".$row[‘CityName‘]."</option>";
}
<script src="__PUBLIC__/bower_components/jquery/city_ajax.js"></script>
city
district