I have been working on updating a table with new data from an ajax url.
The table loads correctly the first time, but I am struggling to get it to refresh.
$(function() {
var datepicker = $( "#date-picker" );
var table = $("#reports1").dataTable({
sPaginationType: "full_numbers",
bJQueryUI: true,
ajax: "http://" + window.location.host + "/admin/update_reports/" + datepicker.val(),
bProcessing: true,
columns: [
{
sTitle: "User",
data: "user_email"
},
...
{
sTitle: "Not Interested",
data: "notinterested"
}
]
});
datepicker.datepicker({
dateFormat: "yy-mm-dd"
}).attr('readonly','readonly').css("background","white").on('change', function(){
alert("Date changed to " + datepicker.val());
table.ajax.reload();
});
});
I do receive the Alert message, indicating that it reaches that point in the code.
I also tried
alert( 'Data source: ' + table.ajax.url() );
But encountered this error
TypeError: table.ajax is undefined