1

Because of certain reasons, I'm sometimes tied to an extremely slow internet connection. What I realized with this, is that certain sites (for example, any subdomain of blog.hu) works in a way that needs a certain part of the site be loaded before comments are loaded too. I assume it's because of an AJAX operation, as the comments themselves are not visible within the HTML file.

In contrast, forum engines, such as vBulletin are often free from AJAX, meaning that when a thread's HTML is loaded, every comment in it are "hardcoded", meaning that even if the "fancy parts" (CSS, images and so on) are not loaded, I can already read the comments.

My needs are very special though, so I'm interested - is there any general UX advantage of any of these?

2

It sounds like you already get the basic pros/cons of AJAX.

AJAX is by definition asynchronous. Therefore it is non-blocking. That means that if while the server is off loading all of the contents it does not stop the rest of the page (html, css, images, etc.) from being loaded. This route is beneficial if you have a lot of comments or a slow algorithm to aggregate the comments. It is better to have the page start rendering immediately than to wait 10 seconds for the comments to be ready before starting to render the page.

If, however, you can ensure the comments are loaded quickly, then it may be beneficial to not load them via AJAX (this "hardcode" method you mention is likely the server side language such as PHP inlining the comments directly). This will avoid the visible "jump" when the comments are loaded after the page is loaded, and then as you said, you may be able to read the comments before images/heavy CSS load. Also if the main content IS the comments it doesn't make much sense to load the page without them.

So in conclusion it will depend a lot on the context of these comments in the page and how fast you can load the comments/other assets.

  • this "hardcode" method you mention is likely the server side language such as PHP inlining the comments directly -> yes, I meant this way. Sorry if it was silly, I call it so because after the query, the comments, as I said, are visible in the source code of the HTML page. – Zoltán Schmidt Dec 1 '16 at 16:47
1

The goal of using AJAX for content should be to enhance the user experience, not to make the user experience depend on it.


Benefits of using AJAX over hardcoded depend on the technical aspects of the server and the importance of the AJAX loaded elements.

The idea of loading elements via AJAX, the way you are describing, is loading the minimum HTML so that the user has the main content as soon as possible. Then, once the scripts are loaded you can load the non-main content via AJAX.

This depends on the case. Are comments an essential part of the website?

If they are you might want to include them in the HTML or at least some of them.

If they aren't you should test how much time you are saving loading that HTML asynchronously. Because using AJAX has also some risks, I can think of:

  • The scripts don't load or spend too long loading, so all the content which was going to be loaded via AJAX will not be loaded.
  • The AJAX call doesn't respond correctly so the user ends up with none of that content.
  • The browser is not loading JavaScript. This is less common but is something to consider.

Imagine comments are made "constantly" so the hardcoded ones can be outdated some minutes after the user receives them. This would be a good situation to use AJAX. The user receives all the content he needs when the page loads and, instead of refreshing the site to see if there are new ones, the site gets the new content for him as soon as it appears.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.