I need to append a DataTable dynamically, I need to fill a form several times and show results in a DT each time a user clicks on the button to send results of their inputs and show the results in my Datatable.
<table id="table" class="display" width="100%"></table>
<button type="button" id="btnOne" class="btn btn-success"> Valider</button>
<script>
$("#btnOne").click(function() {
var reje = $("#table")
reje.DataTable ({
"data" : maj_ref_modeles_json,
"columns" : [
{ "data" : "codemodele" },
{ "data" : "pksegmentation" }
]
});
});
</script>
The datatable is filled correctly for the first set of data, but at the second iteration, I have this message in my browser :
DataTables warning: table id=table - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3