Thank you so much, i think it was a case of me going code blind, i cant believe i didn't think about that.
I've modified your suggestion a bit, i've put it in a javascript file and included it
var Toast = Swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 5000
});
function loadDataTable(div,urlLink){
$(div).html("<div id='loader'><center><i class='fas fa-spinner fa-3x fa-spin -auto m-5'></i></center></div>");
$("#requests-container").load(urlLink, function(){
$("#project-requests").DataTable({
"order": [[0, "desc"]],
"responsive": true, "lengthChange": true, "autoWidth": false, "pageLength": 25,
"aLengthMenu": [[10, 25, 50, -1], [10, 25, 50, "All"]],
"buttons": ["copy", "pdf", "print", "colvis"]
}).buttons().container().appendTo("#project-requests_wrapper .col-md-6:eq(0)");
});
}
So now the call is
loadDataTable("#requests-container","'.DIR.'admin/dashboard/requests");
Basically this so so i can trigger it from anywhere and for anything on the site
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.