There are cities in the database table. How can I fill in an entity field with it?
Populating the field with columns in the database
Collapse
X
-
Tags: None
-
I have one more question. I will do the same in the towns. But how do I relate the city and the town? Because there are the same ID's in the towns.Last edited by gundogduyakici; 03-21-2018, 12:33 PM.Comment
-
-
-
-
-
function changeTowns(a) {
var select = $('select[name="town_id"]');
select.html("");
if ($(a).val() == "") {
select.append('<option value="">Lütfen Seçiniz</option>');
}
$.ajax({
type: 'GET',
url: '<?php echo base_url('admin/ajax/getTowns/');?>' + $(a).val(),
dataType: 'json',
beforeSend: function () {
$('.loadingCity').removeClass("hidden"),
$('.citySelect').addClass("hidden")
},
success: function (data) {
if (data.status == 404) {
alert(data.msg);
} else {
$('.loadingCity').addClass("hidden");
$('.citySelect').removeClass("hidden");
select.append('<option value="">Lütfen Seçiniz</option>');
$.each(data, function (index, element) {
select.append('<option value="' + element.id + '">' + element.name + '</option>');
})
}
}
});
}Comment
Comment