Possible to access new table data without refreshing the entire page/code?

Possible to access new table data without refreshing the entire page/code?

thatgregthatgreg Posts: 6Questions: 4Answers: 0
edited July 2021 in DataTables

https://codepen.io/pen/OJmjZdE

Right now when you first enter the page, you enter a keyword (enter yes) and it gives you data. great

But if you enter a different word after entering the first one, it wont load anything without having to refresh the whole webpage.

Is there a way to make it seamless?

Answers

  • kthorngrenkthorngren Posts: 21,330Questions: 26Answers: 4,951
    edited July 2021

    You are getting this error:

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

    Did you look at the troubleshooting steps in the link provided?

    If you want to re-initialize the Datatable then use destroy as shown in the technote.

    An alternative to destroying the Datatable is to use $.fn.dataTable.isDataTable() to see if the Datatable exists. If not initialize it like you are now. If it does exist then use ajax.url().load() to load data from the change URL.

    Kevin

Sign In or Register to comment.