Stipulate when dataTables loads

Stipulate when dataTables loads

Is it possible to stipulate when a dataTable loads?

I have a form with multiple parts the last of which is the dataTable. But, the information selected for the dataTable from the source is dependent on information the user enters in a previous part of the form. At present, when the page loads the dataTable attempts to load but throws an error because the select from the database throws an error due to the missing parameter.

What I would like to do is determine if the required field is loaded before having the dataTable load.

Here is my code...
  1.     var tsEmpNum = form_edit.ts_EmpNum.value;
        var tsDate   = form_edit.ts_Date.value;
       
        // Load dataTable if date is loaded
        if ( tsDate != '' ) {
            $('#timesheet').dataTable( {
                'bPaginate': false,
                'bLengthChange': false,
                'bFilter': false,
                'bInfo': false,
                'bAutoWidth': false,
                'bProcessing': false,
                'bServerSide': true,
                'sAjaxSource': 'files_json/get_Timesheets.php?tsEmpNum=' + tsEmpNum + '&tsDate=' + tsDate
               
            }); // End of dataTable
        }
















TIA for any assistance
jdadwilson