If you take a look at dynamic websites, the content of the website will be refreshed automatically without user intervention. Example – CricInfo in which the score card will be refreshed in a time interval and display the latest score.
The example which we are going to develop will refresh the ‘DIV’ block for every 5 seconds and display the current web server’s time.
This section will give clear understanding on how the AJAX operation is performed. Let us create simple example which will illustrate the operations involved in making AJAX call. Let us take a quick look at the output of this example before we understand the steps of AJAX operation.
The XMLHttpRequest object is the heart of AJAX. It is available from Internet Explorer 5.5 which was released in July 2000, but not fully used until people started to talk about AJAX and Web 2.0 in 2005.
Despite the name, the use of XML is not required (JSON is often used instead) or even plain text is used, and the requests do not need to be asynchronous.
All browsers cannot support AJAX. Below is the list of browsers which support AJAX:
- Mozilla Firefox 1.0 and above
- Netscape version 7.1 and above
- Apple Safari 1.2 and above.
- Microsoft Internet Exporer 5 and above
- Opera 7.6 and above
- RockMelt browser
Here is the list of web application which are using AJAX:
Google provides suggestions as you type and to navigate over the suggestions, the arrow keys are used.
What is AJAX?
- AJAX is a technique for creating dynamic, better, faster and more interactive web applications.
- AJAX is mainly used in web applications where partial load of a page is needed. For ex: Google Map (Where map will be zoomed on scrolling mouse wheel), Google Suggest (Suggestions will be displayed based on what user typed in the search box).