You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

46 lines
1.4 KiB

/*$(document).ready(function(){
if ($('#id_city').val() == ""){
$('#id_city').attr('disabled', 'disabled')
}
$('#id_city').select2({
width: 'element',
placeholder: 'Выберите страну',
allowClear: true
})
$('#id_country').change(function(){
$.get(
"/ajax_city/", {'id': $(this).val()}, function(j){
//$(this).parent().select2("destroy");
//$(this).parent().select2();
// $('#id_city').find('option').remove();
$('#id_city').html(j);
$('#id_city').attr('disabled', false);
});
});
});*/
$(document).ready(function(){
$.get(
"/ajax_city/", {'id': $('#id_country').val()}, function(j){
$('#id_city').html(j);
//$('#id_city option :first').attr("selected", "selected");
});
$('#id_country').change(function(){
$.get(
"/ajax_city/", {'id': $(this).val()}, function(j){
$('#id_city').html(j);
$('#id_city').attr('disabled', false);
});
});
});