Sunday 24 July 2011

What is AJAX?

    In this post I introduce to you some basic concept of AJAX. As the part of my project I need to create one dynamic website, at that time I heard about this powerful dynamic web development tool. I want to share my learning experience with this post, I think it will useful for all beginners who are interested in Ajax.

    In the 1990s, most web sites were based on complete HTML pages;  That is static web pages. each user action required that the page be re-loaded from the server (or a new page loaded). Each time a page is reloaded due to a partial change, all of the content must be re-sent instead of only the changed information. This can place additional load on the server and use excessive bandwidth. At last we have found a solution for this problem. The term Ajax was introduced by Jesse James Garrett  on February 18, 2005.

What is Ajax?
AJAX is a technique for creating fast and dynamic web pages.

AJAX = Asynchronous JavaScript and XML.

AJAX is not a new programming language, but a new way to use existing standards.

AJAX allows web pages to be updated asynchronously by exchanging small amounts of data with the server behind the scenes. This means that it is possible to update parts of a web page, without reloading the whole page.

Classic web pages, (which do not use AJAX) must reload the entire page if the content should change.

Examples of applications using AJAX: Google Maps, Gmail, Youtube, and Facebook tabs.

Now I think you got an idea about what is Ajax. Next we discuss about the working of Ajax. 

How Ajax works?
This figure shows the working steps of Ajax on the Internet. Ajax uses a programming model with display and events. These events are user actions, they call functions associated to elements of the web page.
Interactivity is achieved with forms and buttons. DOM allows to link elements of the page with actions and also to extract data from XML files provided by the server.
To get data on the server, XMLHttpRequest provides two methods:
  • open: create a connection.
  • send: send a request to the server.
Data furnished by the server will be found in the attributes of the XMLHttpRequest object:
  • responseXml for an XML file or
  • responseText for a plain text.
Take note that a new XMLHttpRequest object has to be created for each new file to load.
Note : AJAX applications are browser- and platform-independent!

AJAX is based on Internet standards. The following technologies are incorporated with Ajax:
  • HTML or XHTML and CSS for presentation
  • the Document Object Model (DOM) for dynamic display of and interaction with data
  • XML for the interchange of data, and XSLT for its manipulation
  • the XMLHttpRequest object for asynchronous communication
  • JavaScript to bring these technologies together



No comments:

Post a Comment