I've built a PHP AJAX pagination that works with an HTML Table. I have a quick question about the AJAX GET Response. Currently.. my pagination script returns the entire HTML table with each GET Response, then empties the DIV where the html table is contained and then places the new HTML table inside the DIV. My question is... Is it better to return the data in JSON or XML format and then build the table within the JavaScript?
I would definitely build the table within javascript, this is scalable, and just a good practice for your whole website. Think about mobile clients for example, where every byte is precious.
Fetch json, which is so much lighter than the whole html build-out. Leverage your client's cpu :)
regards
In my opinion it's best to send data back to the client and then put the data in a table. How the data is send (JSON or XML) isn't important, but I prefer XML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With