AJAX div .load calls and DataTables

AJAX div .load calls and DataTables

KieftenbeltKieftenbelt Posts: 1Questions: 1Answers: 0

At the moment I'm having a div reloaded by AJAX to have the navbar fixed without refreshing.
For instance;

      function callPage( pageRefInput ){       
              $.ajax({
                url: pageRefInput,
                type: "GET",
                dataType: "html",
                success: function( response ) {
                  console.log('the page was loaded', response);
                  $('.content').html(response);
                },  
          }),

This is all fine, loading PHP files where an page is in it, including a DataTables table with content from AJAX php/JSON.
Everything is loading, except the DataTables, where I do kind of understand that this has to be reloaded/reinitialising,
but can't get this to work. Or I get JSON errors, or just doesn't activate the plugin.

The DataTables JS file is as well in the PHP file.

After looking in Inspector, I figured out he doesn't want to load the DataTables content PHP file, even after;
$('#datatables').DataTable().ajax.reload();

Anyone have the same experiences, or ideas to figure this out?

Many thanks.

This discussion has been closed.