AJAX Pattern: Xml Message


 definition
 overview
 ajax pattern in action
 source code



definition

Messages between browser and server contain XML formatted data.

Frequency of use:   medium

overview

AJAX is an acronym for Asynchronous Javascript And Xml. As this name implies, XML is seen as the common message format for communications between browsers and servers. Indeed, XML is a widely accepted and flexible standard.

However, XML tends to be bulky. Also, it is not always clear how the browser should deal the XML coming from the server; it can be stored as data (XML Islands) or it may be rendered into HTML. Either way, rendering involves data transformation which is neither fast nor browser agnostic. For these reasons, XML is frequently not your best option.


ajax pattern in action

In this example a list of customers is retrieved from a database. The user chooses which columns to display, the sort order, and the maximum number of rows retrieved. The data is returned as an XML message from the server. The browser takes this XML and parses and formats it into HTML. The Javascript is browser specific to be able to parse the incoming XML.


Select columns and sort order

     Columns   Sort Order   Max # Rows
      
    
    
    
         


Customers



source code

    Click here to view the source code.