title: Jquery datatable gives error “Requested unknown parameter '0' from the data source for row 0”
body: <p>I am creating json format for jquery datatable using jquery , but it gives error &quot;DataTables warning (table id = 'compare'): Requested unknown parameter '0' from the data source for row 0&quot;
  I've already read <a href="https://datatables.net/manual/tech-notes/4" rel="nofollow noreferrer">https://datatables.net/manual/tech-notes/4</a></p>
  <p>my Html is</p>
  <pre><code>            &lt;div class=&quot;row wrap blocks&quot; id=&quot;table1&quot; &gt;
              &lt;div class=&quot;col-1&quot;&gt;&lt;/div&gt; 
              &lt;div class=&quot;col-10 wrap-inner d-flex align-items-center&quot;&gt;
                  &lt;table id=&quot;div_compare&quot; class=&quot;dtables&quot;&gt;
                      &lt;thead&gt;
                          &lt;tr&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                              &lt;th&gt;&lt;/th&gt;
                          &lt;/tr&gt;
                      &lt;/thead&gt;
                      &lt;tbody&gt;&lt;/tbody&gt;
                  &lt;/table&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>
  <p>and my jquery code is</p>
  <pre><code>var compare =  $('#div_compare').DataTable({
  scrollX: true,
  bPaginate: false,
  pageLength: 15,
  bLengthChange: false,
  bFilter: true,
  bSort: true,
  bInfo: false,
  bOrdering: true,
  bAutoWidth: false,
  pageResize: true,
  lengthChange: false,
  dom: 'lrtip',
  columns: [
      { data:'no',title: &quot;No&quot; },
      { data:'name',title: &quot;Name&quot; },
      { data:'time',title: &quot;Best time&quot;},
      { data:'Atime', title: &quot;Atime&quot;},
      { data:'Btime', title: &quot;Btime&quot;},
      { data:'Ctime', title: &quot;Ctime&quot;},
      { data:'Dtime', title: &quot;Dtime&quot;},
      { data:'lap',title: &quot;Lap No&quot; },
    ],
  columnDefs: [
      { targets:'_all',className : 'dt-body-center'},
      { targets:  0, visible: true, width: 50 },
      { targets:  1, visible: true, width: 50 },
      { targets:  2, visible: true },
      { targets:  3, visible: true },
      { targets:  4, visible: true ,width: 100},
      { targets:  5, visible: true, width: 70 },
      { targets:  6, visible: true, width: 70 },
      { targets:  7, visible: true, width: 70 },
  ],});
  
  getLaptime(query).done(function (response) {
     var comparedata = response.filter(x =&gt; x.order == 2)
     compare.row.add(comparedata).draw();
     compare.columns.adjust().draw();
  }
  
      function getLaptime(data) {
        return doRefreshSession().then(function (headers) {
        return $.ajax({
            url: 'https://URL/laptime/comparelaptime',
            type: 'GET',
            data: data,
            headers: headers
        });
    });
  }
  </code></pre>
  <p>Can anyone help me solve this?</p>