changing data source through an option box
changing data source through an option box
I'm struggling to use the same datatables structure to load different versions of the data. I've searched throughout the site and can't seem to find an example of this. I have a simple option box:
<select name="semester" id="semester">
<option value="fa2017">Fall 2017</option>
<option value="su2017">Summer 2017</option>
<option value="sp2017">Spring 2017</option>
</select>
I thought something like this should work:
$('#semester').change(function () {
var semester = this.value;
if (semester === 'su2017') {
table.ajax.reload( '/2017su.json' );
}
All my semester data will be coming from external .json files. Any direction is greatly appreciated.
Replies
look at https://datatables.net/reference/api/ajax.url().load()