I have a bootstrap modal and i'm fetching divs from controller via ajax. When i click on the modal show button the modal appear but these divs did not appear in the modal. I have to show this dynamic content when modal is open in it. I have call function updateDocumentType(EmployeeID) when modal open but nothing works for me although i have created selected box when i click on select box this function successfully working.
modal show function
function uploadDocument(e) {
var id = $(e).data("id");
$("#documentEmpId").val(id);
$('#documentModal').modal('show');
updateDocumentType(id);
$('#DocumentType').on('change', function () {
updateDocumentType(id);
});
$.ajax({
type: "POST",
url: "/recruitment/documentsData",
data: {
id: id,
},
async: true,
beforeSend: function () {
$('#pageloader').show();
},
success: function (response) {
var type = (response.DocumentType).split(',')
$("#DocumentType").empty()
$("#DocumentType").attr('disabled', false);
for (var i = 0; i < response.poi_array.length; i++) {
$("#DocumentType").append("<option value='" + response.poi_array[i].name + "'>" + response.poi_array[i].name + '</option>');
}
},
error: function (e) {
console.log(e.responseText);
},
complete: function () {
$('#pageloader').hide();
}
});
}
dynamic content function loading from controller
function updateDocumentType(EmployeeID) {
var DocumentType = $('#DocumentType').val();
$.ajax({
type: "post",
url: "/recruitment/updateDocumentType",
data: {
EmployeeID: EmployeeID,
type: 'updateDocumentType',
DocumentType: DocumentType,
},
async: true,
beforeSend: function () {
$('#pageloader').show();
},
dataType: 'JSON',
success: function (response) {
$('#DocumentType').html(response.result.getDocumentType);
$('#poi_documents').html(response.result.getDocuments);
addTippy('.upload');
addTippy('.edit');
},
error: function (e) {
console.log(e.responseText);
},
complete: function () {
$('#pageloader').hide();
}
});
}