title: How to bind ASP.net datatable from javascript/ajax
body: <p>I am using Bootstrap datatable (<a href="https://datatables.net/examples/styling/bootstrap4" rel="nofollow noreferrer">https://datatables.net/examples/styling/bootstrap4</a>)
  for show datatable in aspx page.</p>
  
  <p>I am getting data from database.</p>
  
  <p>I want this from javascript/ajax and refresh table every seconds.
  What is the best way?</p>
  
  <p>I am trying this. Set breakpoint on fillFileTable but breakpoint not work; not entering breakpoint.</p>
  
  <pre><code>$(document).ready(function () {
  
          $('#filesTable').DataTable({
              "order": [[0, "desc"]],
              "bProcessing": true,
              "bServerSide": true,
              "sServerMethod": "POST",
              "sAjaxSource": "files.aspx/fillFileTable"
          });
  });
  
  
  [WebMethod]
  public static string fillFileTable()
  {
     DataTable dt = //...(get table from database)
  
     JavaScriptSerializer js=new JavaScriptSerializer();  
     js.MaxJsonLength = int.MaxValue;  
  
     return js.Serialize(dt);
  
  }
  </code></pre>