Benefit of outputting JSON as opposed to plain HTML

Posted by Franco on Stack Overflow See other posts from Stack Overflow or by Franco
Published on 2011-01-13T17:31:44Z Indexed on 2011/01/13 17:53 UTC
Read the original article Hit count: 270

Filed under:
|
|
|

Hey guys,

Just wondering which is best here. I want to output data from a table in my DB then put a lot of this data into a html table on the fly on my page. Im working with Java on the server side. Basically I pull the results form the DB and have the raw data..just what next?

There is a chance I may want to take data from multiple tables in order to combine it into one table for my site.

I retrieve the results of the query from the DB, now do i create a text from it in the form of json which i can parse as json using jquery upon the return of the object to my browser?(kind of a sub question of this question: Is just using a stringbuilder the correct way to make a json object to output?)

Or..

Should i build the HTML as a string and output that to the browser instead?

Which is better and why?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about java

Related posts about html