代码改变世界

AJAX Introduce

2006-03-01 17:26  Jeff  阅读(194)  评论(0编辑  收藏  举报
    Your first guess is that AJAX is a new technology used in web development. This statement is encouraged by the endless news articles showing sites made with AJAX. In fact AJAX is neither new, nor a technology. It can be seen as a mix of several popular technologies put together to build a friendlier web.
   
The name itself is an acronym for Asynchronous JAvaScript and XML, which already contains two technologies and a technique for loading informationIn this mix, XML is used to store and move information between the client and server, HTML and CSS to format the output and JavaScript to bind all of these elements together in a dynamic manner.
    
The asynchronous part comes from the fact that when a change has to be made to the current page (the user clicks on a link, or submits some information), only the part to change is transferred from the server, and not the entire page. 
     
Besides these, AJAX is about much more:
     
The way information is displayed in a browser – using HTML/XHTML and CSS. To present information to the client, you still need to use the language that browsers understand: HTML for content and CSS for layout and formatting.
    
In the age of dynamic websites, displaying content is not enough. You have to first retrieve it from a dynamic data source, and process it for final output. This is where XML and XSLT come into play.
    
Getting the information from the server and in the user's browser is the next step. The XMLHttpRequest JavaScript object is used for this part.
    
Once the information is displayed you need to modify it dynamically. For this you will use the Document Object Model (or DOM, for short). To provide dynamics to a static HTML page, DOM manipulation is used to alter the properties of already created page elements. It is done through JavaScript and allows (for example) a div element to become visible, or a button to gray-out when a certain selection has been made.
    
The glue that holds all these elements together is JavaScript. This allows retrieving dynamic information, displaying and modifying the page elements. JavaScript is a lightweight programming language used to perform various tasks on the web client.
    
The notion AJAX has come to define a development framework which aims to improve web page usability.