AJAX source
AJAX source
anees
Posts: 4Questions: 1Answers: 0
Hello Dear,
I have two files index.php and datatable.php. datatable.php has full html table which I want to change to datatable. when I put the code of datatable.php on index.ph it works fine. But it does not work when I try to load datatable.php with ajax call.
Please tell me that where should I add the javascript files for datatable ? on index.php or on datatables.php
I have tried in different ways but it is not working for me.
Thanks
This discussion has been closed.
Answers
here is my code
index.php
It loads page with plain table. But datatable does not appear to work on ajax loaded page.
Thanks in advance
I would suggest using DataTables to Ajax source the data for you rather than doing it manually.
Allan
Hello Allan,
Thanks for reply. Actually I have a scenario and I need it in this way. I know about Ajax source. But it is necessary in case that I follow the same thing which I am doing. Can you please help me with it ? these tables are from third party and we do not have control over that to change them.
Thanks
No you don't have to do it that way. If your Ajax feed includes the HTML for the table, then initialise the DataTable in the callback handler. If you need to get another table, then destroy the old table first using
destroy()
.Allan
Hello Allan,
Thanks for the reply. I will check with these tips and will get back to you :) your support is really good.
:)