The question is tricky so I'll post the context:
- I have a fragment on the page that gets loaded via AJAX.
- That page contains a table that will be powered and populated by Datatables with server-side processing.
- Everytime I load the fragment that contains a new table, I tell Datatables to boot the table from scratch, using
bDestroy : true
.
Problem
The AJAX calls that fetch the data as JSON keep piling up as I load new tables via AJAX.
Question
How do I keep these calls from stacking up and reduce them to a single one? Thank you.
Code samples (upon request)
/* datatables initializer */
$("#table").dataTable({
bDestroy : true
, bServerSide : true
, sAjaxSource : "path/to/json.json"
, ...
});
/* script inside the AJAX loaded content. It outputs a <table>. */
$(function() {
$("body").trigger({ type : "tableready", options : { ... } });
});