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
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.
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.
A couple benefits could include:
A couple of tough points could be: