Hey folks, I have a question which feels stupid but I can't quite say why.
Imagine a webapp with users and tags. Users tag each other.
I've got one page in the app which displays details about a single tag in relation to a single user. Let's say user 'bob' and tag 'footag'. On this page, I'm displaying two lists: all the people who have tagged bob with 'footag' and all the people bob has tagged 'footag'. let's call these <div id="received'>
and <div id="sent">
Let's say the url for this view is /users/bob/tags/footag
Naturally, these lists are long -- I don't want to load the whole list upon pageview. So I load the first ten for each.
Now I can provide dynamic paging for each of the lists in one of two ways:
div
./users/bob/tags/footag/received?page=1
. I fetch it asynchronously and just replace the contents of the relevant <div>
.So in one case I fetch data and render it via JS in the browser, the other I fetch rendered data and just plonk it wholesale into the document.
Is there any reason not to use #2? I can't imagine one but I suppose there might be security aspects I'm not considering, or performance, or something else. I'd much prefer to do #2 as it simplifies my life significantly.
Thanks!
Rendered HTML is the HTML structure that exists in the client browser after loading a page has entirely completed, including processes that manipulate the original HTML sent from the server.
Rendering is a process used in web development that turns website code into the interactive pages users see when they visit a website. The term generally refers to the use of HTML, CSS, and JavaScript codes. The process is completed by a rendering engine, the software used by a web browser to render a web page.
What does webpage rendering mean? Rendering a webpage is the process of turning HTML, CSS, and JavaScript code into an interactive page that website visitors expect to see when clicking on a link. Every website page is designed with the end user in mind.
What is "rendering"? Ultimately, it is a process of displaying data in a UI component. Suppose the component is drop-down list displaying some items. Rendering and re-rendering of the drop-down list will force the component to update its contents.
I've got an app like this -- I use both methods.
I use your Method #1 to update fields that aren't contiguous (e.g. input fields all over the place), but I use your Method #2 to update tabular data, kind of like your lists.
I would stick to #2 for your case.
i'd go with #1 ... so you really get the data, not just some HTML ... it will simply be a concise JavaScript object structure and not some string, so you can evaluate the data at will, cache it, use it for searches, etc. ... the more work is done on the client side, and the cleverer it is, the better you app scales ... you have 1 server, or maybe 2-10, or i don't know, but you have 10-10000 more clients ...
greetz
back2dos
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