Currently using the jQuery Datatables plugin.
I now need to be able to change the ajax data source based on some form input values, which would be submitted on a button click?
What is the recommended method for achieving this?
$(document).ready(function () {
$('#btnReport')
.click(function () {
var table = $('#reports').DataTable();
table.ajax.reload();
});
var querystring = '?from=' + $('#datetimepickerFrom').val() + '&till=' $('#datetimepickerFrom').val();
var url = '/api/reports/custom';
var table = $("#reports").DataTable({
ajax: {
url: url + queryString,
dataSrc : ""
},
columns: [
{
data: "fullName"
},
{
data: "timeIn"
}
]
});
});
Many thanks