I am writing a web-application in which I am retrieving data's from server through
AJAX requests and the generate
HTML content dynamically.
I have some data to load, generate HTML from it and
append into my web page.
Now I was thinking on two solutions:
1) Do AJAX call, generate HTML from response, set
display: none to it when I need, and when I'll need it later, set
display: block; instead and
hide() other content I don't need to display (always dynamically generated).
2) Save AJAX response into
variables, remove HTML generated before, re-generate from
variable when I'll need it later.
I don't know if I explained it well, but I would like to know which is best practice in terms of client/server performance.