php & js data best approach
php & js data best approach

I have question regarding best approach when using data from a php query and passing to datatables.
I have a <?php echo $dsSearch; ?> within a <script> tag... which returns a dataset to the js data variable.
the page source looks like...
all of this works. However, my question is what is the best approach to this scenario. I'll get to the point with big data this might become an issue.
there has to be a bettter, cleaner way. I wouldn't think that showing your data in js is correct either...
please help.
Answers
I would look at the data sources examples
https://datatables.net/examples/data_sources/
and determine which approach suits your needs.