LiveUI Ajax Support

There are two commonly used approaches for creating web applications with rich client side functionality. One is server centric and other is client centric. With server centric approach server side application performs all logic and forces client side browser to show the results, with client centic approach client itself sends requests to server for data and makes decisions. Usually client centic solutions are simpler but they are neither extensible nor modular. In contrast, server centric solutions are a bit more complex but they have better chances to be modular, flexible and testable.

LiveUI supports server centric approach. With LiveUI essential application logic is performed by server side application model. This application model knows little about presentation and nothing about Ajax. This approach provides flexibilty and testability but it makes presentation layer to perform complex client side interaction. To simplify this interaction LiveUI follows elementary principle: Result of any ajax request to server is just html and javascript.  

Fortunately default ASP.NET request processing system fits nicely to this concept. There are ajax request processing stages:

  • Client side javaScript creates ASP.NET Ajax request
  • Application model and presentation are initialized on server side
  • Request is processed by server side components
  • If presentation was affected it dynamically generates html and javascript
  • All generated JavaScript and Html sent are sent to client

The toughest trouble there is to generate JavaScript dynamically, almost everything else ASP.NET does itself. To solve the problem LiveUI creates JavaScript object model and provides tools to manage it efficiently. At the end of request processing pipeline javaScript models transforms to text.