Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 81909

Mapping json response array and reloading ajax

$
0
0

I have a date selector used for a "WHERE" condition in a SELECT statement...the json encoded result is received back to the ajax calling script.for loading the datatable.
1) HTML table

Member Name Cash Check Check Detail Credit Card Paypal Click on Receipt

2) js
$(document).on("click","#btnSubmitDateSummary",function() //Click a submit button after selecting the date
{
var summaryDate = $("#summaryDate").val(); //MM/DD/YYYY
var url_get_data = "xxxxxxxx/get_day_summary.php?summaryDate=" + summaryDate;

  var table = $('#table_members').DataTable({
    "retrieve": true,  //table will be reloaded with different data
    "paging": true,
    "lengthChange": true,
    "searching": true,
    "ordering": true,
    "info": true,
    "responsive": true,
    "autoWidth": false,
    "pageLength": 10,
     "columns": [
    { "data": "name" },
    { "data": "cash" },
    { "data": "check_amount" },
    { "data": "check_detail" },
    { "data": "creditCard" },
    { "data": "paypal_amount" },
    { "data": "test" }
    ]
  });
 table.ajax.url(url_get_data).load();

});

3)json response is good and as expected:
{"name":"Leota Dilliard","cash":"45","check_amount":"0","check_detail":"","creditCard":"0","paypal_amount":"0","test":"test"}

Success: can select different dates, and will get different response...that is good.
Failure : No data in the table..."No data available in table"

What am I doing wrong ?


Viewing all articles
Browse latest Browse all 81909

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>