c# - Data Table Ajax Call -


i trying fetch data database through jquery datatable , gives error as:

"datatables warning: table id=tblbinddata - cannot reinitialise datatable."

function binddata() {      $("#tblbinddata").datatable({         "processing": true,         "serverside": true,         "sajaxsource": "firsttask.aspx/populatedatatable",         "fnserverdata": function (ssource, aodata, fncallback) {             aodata.push({});             $.ajax({                 "datatype": 'json',                 "contenttype": "application/json; charset=utf-8",                 "type": "post",                 "url": ssource,                 "data": aodata,                 "success": function (msg) {                     var json = jquery.parsejson(msg.d);                     fncallback(json);                     $("#tblbinddata").show();                 },                 error: function (xhr, textstatus, error) {                     if (typeof console == "object") {                         console.log(xhr.status + "," + xhr.responsetext + "," + textstatus + "," + error);                     }                 }             });         }     });  } 

there mistakes in code,

  1. you have given datatype : json , there no need using jquery.parsejson(msg.d).
  2. if using "contenttype": "application/json; charset=utf-8", , should serialize data before passing ajax. better remove contenttype yur ajax call.

Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -