jQuery Datatables use function as ajax data source instead of path or url
<p>How do you use functions as a data source for ajax with datatables? I'm using it in an electron application with a built in database where i'm calling a function, writing the results to a data.json file, and then using the file as the source:</p>

<pre><code>populateData(); //gets data from db and writes output to data.json

let table = $('#accTransaction').DataTable({
      dom: 'Bfrtip',
      select: {
        style: 'single'
      },
      ajax: '../data.json',
      ...
</code></pre>

<p>Instead, it would be more efficient if I could call the db function directly like this but it's not working....not valid url.</p>

<pre><code>let table = $('#accTransaction').DataTable({
      dom: 'Bfrtip',
      select: {
        style: 'single'
      },
      ajax: getData(),
      ...
</code></pre>

<p>I realize I can make the source 'data: newData,' but then I loose the ablility to call <code>table.ajax.reload</code></p>

<pre><code>setInterval( function () {
  table.ajax.reload( null, false ); // user paging is not reset on reload
  console.log('reloading..')
}, 3000 );
</code></pre>

<p>How do you use functions as a data source for ajax with datatables instead of url's or file paths?</p>