3 ms·
First reason is the one that is most likely. There are many kinds of users on the WWW and they use many kinds of web browsers. So the only constant they all rec
by qpiox 7y ago
First reason is the one that is most likely. There are many kinds of users on the WWW and they use many kinds of web browsers. So the only constant they all recognize is HTML and the only way to realize an application over the web that will be accessible to all those users, is by rendering it as HTML completely on the server.
Also, from technical point of view there is no point in generating JSON output (or any other format), and use that format by a JavaScript based processor to generate HTML, when you can directly generate HTML that will be as simple as the JSON. There are not many savings. Why?
3 results of a simplified query engine output in HTML:
[DIV class="results"]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
[DIV class="result"] [DIV class="url"]URL[/DIV] [DIV class="description"]description[/DIV] [/DIV]
These results are usable as is, the browser will render them and does not need anything else to do it.
3 results of a simplified query engine output in JSON:
"results": [
{
"url": "URL",
"description": "DESCRIPTION"
},
{
"url": "URL",
"description": "DESCRIPTION"
},
{
"url": "URL",
"description": "DESCRIPTION"
}
]
This output does not save much space. It is equally as complex on the server-side.
But this output is not usable by the user as will not be displayed in a usable form, so you need JavaScript code to process it and generate HTML that will be usable.
So why generate the same list of things two times? It is better, easier and more accessible for the user if you generate HTML the first time.
Just my opinion. This might not be the real reason.