skip to Main Content

In a standard MVC web application, is it ok to render most of the content with ajax calls?

Let’s take Facebook as example, they load dynamically most of the content.
Should we follow this approach? What measures should we take to assure a good user-experience and performance?

EDIT
Let me clarify the question:

I used the Facebook example because I was thinking to address the question on a application similar to Facebook News Feed: a big set (almost infinite) of entities very similar between them, that can’t be fetched by the controller for obvious performance and response issues.

So we would have items loaded dynamically with ajax calls and rendered using a templating engine.

Is this approach reasonable? What should we do to to assure a good user-experience , performance and reasonable SEO? (e.g. limit number of simultaneous ajax calls, etc)

3

Answers


  1. The question is a little vague, as I think the UX of ajax based websites will vary site to site. This is also probably not the best forum to post this question.

    However in my opinion, ajax can be great tool to improve UX. Reduced page refreshes, render fresh content and performing tasks without disrupting the user current state is a big plus.

    However, if your site is complex, and has a lot of navigation, ajax can become a nightmare for both developers and users.

    It will more than likely cause some dependencies on JS/JQ which may not be an option.

    Login or Signup to reply.
  2. I think its a good idea. But there are few things that you need to keep in mind.
    Javascript always takes time to load.
    So if you create dom mostly in js it would definitely give the user a feel that the website is slow during initial loading.
    Just standing static html is way faster.
    So the idea is to have mostly static html and intelligently use javascript for dom creation this way not only the user has a feel that js is fast
    But also the server resources are well used.
    So the best idea is to use an intelligent combination of the two.
    Off course for ajax calls always prefer dom creation through javascript unless you have huge data to be binded to your dom.
    In short it depends on your requirements and the resources and target users.

    Login or Signup to reply.
  3. A couple benefits could include:

    • server could implement api interface, which would allow it to be client agnostic
    • endpoints are more focused and discrete
    • web client could be easier to develop, could develop in parallel as long as there is a clear API spec

    A couple of tough points could be:

    • Difficulty in determining how focused should each api endpoint be? what data should be returned?
    • client could end up making many small ajax requests, overhead of many connections
    • handling when a single request fails or loads slowly
    • consider performant dom manipulation, when rendering data returned by api
    • per endpoint caching – even though endpoints might be very focused, a single page view on the front end could logically correspond to a group of endpoints
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search