how to clear datatable again load the table data code example
Example: datatables clear table
const table = $("#yourTable").DataTable();
table.clear().draw(); // make sure to call draw() to see the table empty
const table = $("#yourTable").DataTable();
table.clear().draw(); // make sure to call draw() to see the table empty