1
votes

I'm insertitng in table new record with ajax, and in success I'm want update table

success: function () {
                            alert('Success!');

                            var table = $('#datatable_ajax').DataTable( {
                                ajax: "\/ajax\/client-objects"
                            } );
                            table.ajax.reload();
                            alert('Table redrawn!');

                        },

DataTables warning: table id=datatable_ajax - Cannot reinitialise DataTable. For more information about this error, please see http://datatables.net/tn/3

How I can use ajax.reload to refresh table data ?

1

1 Answers

3
votes

It looks like DataTable is already initialized on '#datatable_ajax' element, so you can't initialize it again. If you want to add new url source and load data from it, use table.ajax.url('newData.json').load(); if you want to just reload data use table.ajax.reload(); without reinitalization of DataTable.