Add a row dinamicaly from external javascript
Add a row dinamicaly from external javascript
jaarmario
Posts: 4Questions: 1Answers: 0
Can I add a row to the table from a javascript code?
I have a form in my php code and insert data to the mysql database, but I want to show this new data in the datatable than I have put below this form.
Can I do it? or I can't?
This discussion has been closed.
Replies
To add new data to Datatables you can use
row.add()
orrows.add()
.Kevin
I try it, but only works if is inside document.ready( ......
If out side, I think the variable is outside of the global ambit.
It thrown an error
Uncaught TypeError: Cannot read property 'row' of undefined
If the Datatable is initialized you can access the API. Here is the doc explaining how:
https://datatables.net/manual/api
Kevin