AJAX, which stands for Asynchronous Javascript and XML, is a web development tool used on the client side to create interactive web applications, also known as Rich Internet Applications (RIAs). With AJAX, web applications can retrieve data from the server asynchronously in the background without interfering with the display and behavior of the existing page. The use of AJAX has led to an increase in interactive animation on web pages and better and faster display of data due to asynchronous mode, wherein the entire page data does not get loaded again and only the impacted tags of data get loaded. Data is retrieved using XMLHttpRequest object, Despite the name (AJAX), the use of Javascript and XML is not actually required, nor do requests need to be asynchronous.
In many cases, related web pages have the same content and even in the case of the same page, if a request on that page is made multiple times, then each time all the contents of the page need to be re loaded. However, using AJAX, the web page can request only the content which needs to be refreshed or updated, thus drastically reducing network bandwidth usage and load time. These asynchronous requests allow the clients web browser UI to be more interactive and respond more quickly to user inputs. With AJAX sections of the web page can also be reloaded individually. Thus the application becomes faster and more responsive, since scripts and stylesheets dont have to be requested or loaded again and again. State can be maintained throughout the web site. Javascript variables will persist because the main container page need not be reloaded.
AJAX is based on the following web standards
- HTML
- CSS
- Javascript
- XML
In AJAX, the JavaScript uses the XMLHttpRequest object to communicate with the server. With this object the webpage can make a request to and get a response from a web server without reloading the page. The user will not even notice that a request has been made to and data has been retrieved from the server.
The below diagram illustrates the process flow of communication that takes place between client and server during an AJAX call.
Older versions of Internet Explorer (IE5 and IE6) use an ActiveX object instead of the XMLHttpRequest object. So before using XMLHttpRequest in old browsers we have to check if the browser supports the XMLHttpRequest object, or else we have to create an ActiveX object.
varable = new ActiveXObject("Microsoft.XMLHTTP");
First AJAX application using JSP
Second AJAX application with JSP

No comments:
Post a Comment