библиотеку выбора Sweetalert, но у меня она не работает
Это мой HTML-код
Код: Выделить всё
Religion:
Код: Выделить всё
function populateReligionDropdown() {
$.ajax ({
url: 'data/fn_getData_admin.php?mod=workerReligion',
type: 'GET',
dataType: 'json',
async: false,
success: function(response) {
//Assuming the response is an array of objects with 'id' and 'itemname' properties
var religionDropdown = $('#updateReligion');
religionDropdown.empty(); //Clear existing options
religionDropdown.append("");
console.log(response.workerReligion);
$.each(response.workerReligion, function(index, item) {
religionDropdown.append(`${item.religion}`);
});
$('#updateReligion').select2();
},
error: function() {
//Handle AJAX error
Swal.fire('Error occurred while fetching religion data. Please try again');
}
});
}
Данные будут отображаться в раскрывающемся списке, и пользователь сможет выполнять поиск из списка.
Подробнее здесь: https://stackoverflow.com/questions/781 ... rary-issue