My ajax call is not being fired
My ajax call is not being fired
I am trying to bind data which has more than 10000 rows and but i am unable to get it work. My ajax call is not being fired.
$('#Table1').DataTable({
"processing": true,
"serverSide": true,
"ajax": {
"type": "POST",
"cache": false,
"url": "AssetList.aspx/getAllassetListWithDetails",
"dataSrc": "data.d"
},
"columns": [
{ "data": 'ast_code' },
{ "data": 'descp' },
{ "data": 'catname' },
{ "data": 'locname' },
{ "data": 'grpname' },
{ "data": 'ccntrname' },
{ "data": 'qty' },
{ "data": 'bookval' },
{ "data": 'cactnetval' },
{ "data": 'itnetval' }
]
});
Answers
Thanks for your question. As noted in the forum rules, please post a link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Allan
i have changed my code to work for server side.
$("#Table1").DataTable({"filter": false,"pagingType": "simple_numbers","orderClasses": false,"order": [[0, "asc"]],"info": false,"scrollY": "450px","scrollCollapse": true,"bProcessing": true,"bServerSide": true,"sAjaxSource": "AssetList.aspx/getAllassetListWithDetails","fnServerData": function (sSource, aoData, fnCallback) {$.ajax({"dataType": 'json',"contentType": "application/json; charset=utf-8","type": "POST","url": sSource,"dataSrc": "data","success": function (data) {var json = jQuery.parseJSON(data.d);fnCallback(json);$("#Table1").show();},error: function (xhr, textStatus, error) {if (typeof console == "object") {console.log(xhr.status + "," + xhr.responseText + "," + textStatus + "," + error);}},});}});now i am getting an error saying ::
jquery.dataTables.js:2610 Uncaught TypeError: Cannot read property 'length' of undefined
Allan asked you for a link to a running test case.
My guess is that the server isn't returning the expected JSON, but yes, we would need a test case.
Allan