Server vs. Client AJAX
It’s important to understand the difference between server-centric “AJAX” and client “pure” AJAX.
In server-centric AJAX applications, even though the application leverages asynchronous calls between client and server, the server is the one that is actually responsible for generating the necessary HTML content before providing it to the client. This leads to heavy bandwidth usage, and lack of responsiveness. In addition, the client application becomes far too reliant on the functionality of the server, and its ability to provide good markup, as opposed to simply requiring data and simple interaction.
In client AJAX applications, the communication with the server is purely for passing data back and forth. All of the rendering and state is maintained within the client environment, and the server is only brought into the picture as needed.
So, “The server should only be concerned with data, not presentation”.
In order to enable our ability to easily create dynamic UI and place the rendering process on the client, we need a way to define templates of markup that represent the UI we wish to create, and allow the runtime to instantiate them for us. This alleviates the need to write a bunch of DOM code or depend on server-rendering.
If you’ve used WebForms before, you’re already familiar with the approach many of its server controls take. You have access to a set of properties that allow you to define arbitrary templates of content, complete with HTML, server controls, and data binding expressions. This model makes it very easy to create dynamic UI that is rendered server-side [Advance Animation].
ASP.NET AJAX 4.0 introduces the ability to define templates as well, but purely client-side. Now you can create the HTML markup you want to use for representing your template, complete with HTML and data binding expressions. In this example, we’ve created an unordered list template whose content is a list item whose content is the value of the Name property of the JSON object that is bound to it. The data binding expression resembles that of WPF.
