2023-05-01 20:26:29 +08:00
|
|
|
function getCountry(code){
|
|
|
|
$.ajax({
|
|
|
|
url : './json/third-level-address.json',
|
|
|
|
type : 'get',
|
|
|
|
async: false,
|
|
|
|
success : function(data) {
|
|
|
|
if(data=="error"){
|
|
|
|
alert("系统错误");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
var country = new Array();
|
|
|
|
var children = new Array();
|
|
|
|
var countryCode=new Array();
|
|
|
|
$.each(data,function(i,tmp){
|
|
|
|
countryCode.push(tmp.code);
|
|
|
|
country.push(tmp.name);
|
|
|
|
children.push(tmp.children);
|
|
|
|
});
|
|
|
|
$('#country').show().html(country);
|
|
|
|
// console.log(children);
|
|
|
|
var options = "<option value='0'>--请选择--</option>";
|
|
|
|
for(var i in data){
|
|
|
|
if(code && code == data[i].code ){
|
|
|
|
options += "<option value='" + data[i].code + "' selected>" + dataJson[i].name+"</option>";
|
|
|
|
}else{
|
|
|
|
options += "<option value='" + data[i].code + "' >" + data[i].name+"</option>";
|
|
|
|
}
|
|
|
|
$("#province").html(options);
|
|
|
|
// console.log(data[i].code);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
error : function(data) {
|
|
|
|
html = "<option value='0'>--请选择--</option>";
|
|
|
|
}
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function showCity(){
|
|
|
|
|
|
|
|
}
|