I am having trouble getting the fnServerData to poplulate the DataTable. My web service is called fine and returning data that I can access, however the DataTable constantly says "Processing"
I have it working fine with this code which gets the returned JSON from the web service before calling the dataTable plugin, however I need to be able to use the ServerSide processing as well for large datasets which I am assuming will not work with this method for obvious reasons.
Working code:
Non-working code:
If I uncomment my alerts I get actual data so I know the web service is being called and returned correctly. I do have to deal with .d from the asmx web service, but it seems to work fine in the first example so I am not sure why it won't work fine in the second example.
Thanks!
Tim
I have it working fine with this code which gets the returned JSON from the web service before calling the dataTable plugin, however I need to be able to use the ServerSide processing as well for large datasets which I am assuming will not work with this method for obvious reasons.
Working code:
$.ajax({ type: "POST", url: "http://localhost:52350/Webservice/AllReports.asmx/GetAllReports", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (json) { //alert(json.d); //alert(json.d[0].SDRRID); //alert(json.d[0].ReportNumber); $('#example').dataTable({ "bProcessing": true, "bJQueryUI": true, "sPaginationType": "full_numbers", "aaData": json.d, "aoColumns": [ { "mDataProp": "SDRRID" }, { "mDataProp": "ReportNumber" } ] }); } });
Non-working code:
$('#example').dataTable({ "bProcessing": true, // "bServerSide": true, "sAjaxSource": 'http://localhost:52350/Webservice/AllReports.asmx/GetAllReports', "aoColumns": [ { "mDataProp": "SDRRID" }, { "mDataProp": "ReportNumber" } ], "fnServerData": function (sSource, aoData, fnCallback, oSettings) { oSettings.jqXHR = $.ajax({ "dataType": 'json', "contentType": "application/json; charset=utf-8", "type": "POST", "url": sSource, "data": aoData, "success": function (json) { // alert(json.d); // alert(json.d[0].SDRRID); // alert(json.d[0].ReportNumber); fnCallback(json.d); } }); } });
If I uncomment my alerts I get actual data so I know the web service is being called and returned correctly. I do have to deal with .d from the asmx web service, but it seems to work fine in the first example so I am not sure why it won't work fine in the second example.
Thanks!
Tim