I've never seen the construct:
document.getElementById("tabs").innerHTML = <?php . . . etc
as an implimentation of AJAX. At the very least it makes your code that much harder to read (if it works - I have my doubts). The PHP is in a separate file that is run on the server. PHP is not run on the client and for your page to even begin to work would require it be completely refreshed with arg's that are picked up and used in the PHP to build the page.
If it's new to you,
review AJAX[
^].
That should be Job 1.
Then have all of the data work and manipulation done on the server-side in your php file that does the query and manipulates the returned data.
So, if your PHP gets data
- Build the table in a loop, concatenating each of the items into a single string.
- That single string is returned to the calling page (javaScript AJAX routine) via ECHO. Not multiple ECHO commands.
- that returned value is then assigned to .innerHTML for your table element.
Also:
You can make this all more efficient - IF the column heads <th> are always the same: assign an id to the <tbody> element and just build the contents in your AJAX call and assign it there as the .innerHTML . If replacing headers, build them into your AJAX, etc. The surrounding div's are really best used for controlling the rendering if it can't been done simply in the <table> element. If your return of 'no data' is going to have it's own headers you must instead work at the level accessing the table id (thead and tbody are part of one big string - and actually useless in many contexts).
Personally - I hate sliders. A drop list for the dates is much easier and doesn't require the user (and their unknown physical abilities) to carefully slide until they get the correct value.