I have looked for similar posts here, but i couldn't find post that matches my requirements. I am trying to display the jquery datatables. On the UI, i get to date parameters and make a ajax call to the servlet. The servlet will process and return the json data. Once i get the data i want to show the results in the datatables. But my code is not working. I am new to Datatables. Here's my code :
function fetchLogs(){
$.ajax({
type: "POST",
url: "LogsServlet",
data: 'FromDate='+from+'&'+'ToDate='+to,
dataType: 'json',
success: function(data){
/*$('#logs').dataTable({
"aaData": data,
"aoColumns": [{ "mDataProp": "Executed_AT" }, { "mDataProp": "User_Name"}]
});*/
$('#logs').dataTable( {
"bProcessing": true,
"sAjaxSource": data
} );
}
});
}
The json data that the servlet returns:
[{"user_id":"[email protected]","executed_at":"Jul 8, 2013 7:22:59 PM"}]