I really don't understand why my code is not reloading because when I use early it works fine but now it's always throw this error:
DataTables warning: table id=staff_rep - Invalid JSON response. For more information about this error, please see http://datatables.net/tn/1
$(document).ready(function() {
$('#staff_rep').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": false,
});
});
var usid;
$(document).on('click', '.del', function() {
usid = $(this).attr('id');
$('#confirmModal').modal('show');
});
$('#ok_button1').click(function() {
$.ajax({
url: "destroy/" + usid,
beforeSend: function() {
$('#ok_button1').text('Deleting...');
},
success: function(data) {
// setTimeout(function() {
// $('#confirmModal').modal('hide');
// $('#ok_button1').text('Ok');
// $('#staff_rep').DataTable().ajax.reload();
// }, 1000);
if (data.type == 'success') {
$('#confirmModal').modal('hide');
$('#ok_button1').text('Ok');
$('#staff_rep').DataTable().ajax.reload();
}
}
})
});
Rory McCrossan
338k41 gold badges322 silver badges353 bronze badges
default
storage/logs/laravel.logfile for any backend errors.columns: [...]DataTable option.