<script>
$(document).ready(function(){
$('#area_province').on('change', function(){
//alert('好');
var id = $(this).val();
//alert('id='+id);
var url = 'index.php?m=admin&c=area&a=children&id='+id;
$.getJSON(url,function(data){
//alert(data);
//console.log(data);
var option;
if(typeof data == 'object'){
//遍历data
//option = data[0];
$.each(data,function (key,value){
//console.log(option);
option +=('<option value="'+value.id+'">'+value.areaname+'</option>')
});
//将产生的option插入到文档中
$('#area_city').html(option);//相当于innerHTML
};
});
});
$('#area_city').on('change', function(){
//alert('好');
var id = $(this).val();
//alert('id='+id);
var url = 'index.php?m=admin&c=area&a=children&id='+id;
$.getJSON(url,function(data){
//alert(data);
//console.log('aaaa');
var option;
if(typeof data == 'object'){
//遍历data
option = data[0];
$.each(data,function (key,value){
//console.log(value);
option +=('<option value="'+value.id+'" style="50px">'+value.areaname+'</option>')
});
//将产生的option插入到文档中
$('#area_dist').html(option);//相当于innerHTML
}
});
});
});
</script>