title: requested unknown parameter '0' for row 0 column 0 after ajax call
body: <p>I Would like to use server side rendering while fetching data from server. When I click paging button on datatable I want to upload new data from server. So I used below codes for this. But I get this error
  "DataTables warning: table id=MyDataTable - Requested unknown parameter 'CompanyName' for row 0, column 0. For more information about this error, please see <a href="http://datatables.net/tn/4" rel="nofollow noreferrer">http://datatables.net/tn/4</a>" always.</p>
  
  <pre><code> public class HomeController : Controller
      {
  
          public async Task&lt;ActionResult&gt; Index()
          {
  
              return View();
          }   
  
          public async Task&lt;JsonResult&gt; GetEmployeeRecord(DataTablesParam param)
          {
              var a = await new CompanyService().Getlisttt(x =&gt; x.Phone1 == "12345688");
              List&lt;CompanyViewObject&gt; List = new List&lt;CompanyViewObject&gt;();
              int pageNo = 1;
  
              if (param.iDisplayStart &gt;= param.iDisplayLength)
              {
  
                  pageNo = (param.iDisplayStart / param.iDisplayLength) + 1;
  
              }
  
              int totalCount = 0;
  
  
              totalCount = a.Count();
  
              List = a.Skip((pageNo - 1) * param.iDisplayLength).Take(param.iDisplayLength).Select(x =&gt; new CompanyViewObject
              {
                  CompanyName = x.CompanyName,
                  Description = x.Description,
                  GlobalCompanyID = x.GlobalCompanyID,
                  Phone1 = x.Phone1,
                  CompanyTypeName = x.CompanyTypeName,
                  CompanyOwnershipName = x.CompanyOwnershipName,
                  CompanyIndustryName = x.CompanyIndustryName,
                  ParentID = x.ParentID,
                  Website = x.Website,
                  EMail = x.EMail,
                  Phone2 = x.Phone2,
                  Fax = x.Fax,
                  Confirmed = x.Confirmed,
                  Active = x.Active
  
              }).ToList();
  
  
  
              return Json(new
              {
                  aaData = List,
                  sEcho = param.sEcho,
                  iTotalDisplayRecords = totalCount,
                  iTotalRecords = totalCount
              });
          }
  }
  </code></pre>
  
  <p>My view page is this</p>
  
  <pre><code>&lt;div class="row pt-10"&gt;
  
      &lt;div class="col-md-12"&gt;
          &lt;table class="display" id="MyDataTable"&gt;
              &lt;thead&gt;
                  &lt;tr&gt;
                      &lt;th&gt;
                          CompanyName
                      &lt;/th&gt;
                      &lt;th&gt;
                          Description
                      &lt;/th&gt;
                      &lt;th&gt;
                          GlobalCompanyID
                      &lt;/th&gt;
                      &lt;th&gt;
                          Phone1
                      &lt;/th&gt;
                  &lt;/tr&gt;
              &lt;/thead&gt;
  
              &lt;tbody&gt;&lt;/tbody&gt;
  
          &lt;/table&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  
  
  &lt;script&gt;
  
      $(document).ready(function () {
  
  
             // $("#MyDataTable").DataTable();
  
             BindDataTable();
          })
  
      var BindDataTable = function (response) {
          var x;
  
  
          $("#MyDataTable").DataTable({
              "bServerSide": true,
              "sAjaxSource": "/Home/GetEmployeeRecord",
              "fnServerData": function (sSource, aoData, fnCallback) {               
  
  
                  $.ajax({
  
                      type: "Get",
                      data: aoData,
                      url: sSource,
                      success: fnCallback,
  
                  })
  
  
                  console.log(fnCallback);
              },
  
  
              "columns": [
  
                  { "data": "CompanyName" },
                  { "data": "Description" },                
                  { "data": "Phone1" },
                  { "data": "GlobalCompanyID" },
  
              ]
  
          });
  
          console.log(x);
  
  
          }
  
  
  &lt;/script&gt;
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>Edit=when I change code like this I dont get error but I still cant get values on table</p>
  
  <pre><code>"columns": [
  
          { "data": 'aaData["CompanyName"]' },
          { "data": 'aaData["Description"]' },
          { "data": 'aaData["Phone1"]'},
          { "data": 'aaData["GlobalCompanyID"]' },
  
  
      ],    
  </code></pre>
  
  <p>My ajax return is object is like this</p>
  
  <pre><code>{"sEcho":1,"iTotalDisplayRecords":137,"iTotalRecords":137,"aaData":[{"globalCompanyID":13,"companyTypeName":"Other","companyOwnershipName":"Other","companyIndustryName":"Engineering","parentID":0,"companyName":"ffff","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":false},{"globalCompanyID":14,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 1","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":15,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 2","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":16,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 3","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":17,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 4","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":18,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 5","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":19,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 6","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":20,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 7","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":21,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 8","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true},{"globalCompanyID":22,"companyTypeName":"Prospect","companyOwnershipName":"Public","companyIndustryName":"Agriculture","parentID":0,"companyName":"Company 9","website":"www.youtube.com","eMail":"support@micromarin.com","phone1":"12345688","phone2":"333333333333","fax":"7788554422","description":"Yeni kurulan bir firma","confirmed":true,"active":true}]}
  </code></pre>
  
  <p>I added below code to startup.cs in public void ConfigureServices(IServiceCollection services)  and problem solved I guess controller had not returned json format before. After update controller return Json</p>
  
  <pre><code>Services.AddMvc().AddJsonOptions(options =&gt; options.SerializerSettings.ContractResolver = new DefaultContractResolver())
  </code></pre>