How to Trigger a Function When Data is Loaded via AJAX in DataTables?

I am using DataTable in my Laravel project. I am loading data using AJAX. Now, I need to execute a particular function every time the DataTable finishes loading data successfully via AJAX. Essentially, I want to trigger an event upon completion of each AJAX request for DataTable loading. How can I implement this functionality?

You can utilize the xhr.dt event provided by DataTables to execute code every time an AJAX request completes successfully. So you can do something like this:

$('#data-table').on('xhr.dt', function (e, settings, json, xhr) {
    // Do you crazy stuff here
    ajax: 'data.json'

Here is the documentation.