Ajax Tutorial
In this section we will read about the Ajax.
This section will describe you about the Ajax. After reading this section you will be better understand What is Ajax, Advantages of Ajax, Ajax XMLHttpRequest, How Ajax works, Ajax Web Frameworks.
Ajax is an acronym for Asynchronous JavaScript and XML. Ajax is used for transferring the data with a server. A web page that is using Ajax loads a part of web page with new value instead loading the whole page. Ajax is not a new programming language, it is a way of using the standards already existed. As it is named Asynchronous JavaScript XML, it uses the XMLHttpRequest object, JavaScript, XML.
Ajax uses JavaScript that facilitate to act with the browser and response to the event, use of XML supports the data passing between the server and client, to transfer the XML data asynchronously between the client and server it uses XMLHttpRequest object. It also uses Document Object Model that facilitate to access and manipulate the page's HTML structure.
There are various of Advantages of using Ajax. These are as follows :
- Ajax supports all the new and modern browsers.
- One of the main Advantages of Ajax that it updates only a part of web page instead updating the whole web page.
- Using of Ajax processing of web page get fast.
- Using of Ajax traffic between the client and server is reduced
XMLHttpRequest object sends the HTTP or HTTPS request to a server as well as loads the response data from server into the script. This request is sent to and load response data from server directly. Using the XMLHttpRequest object a developer gets the facility for doing the following tasks :
- A part of web page can be updated instead of reloading the whole page.
- After loading a web page you can request data from server.
- After loading a web page you can receive data from server.
How Ajax Works ?
From generating request to loading response an Ajax follows the following sequence :
The first step is started when an event is generated such as an anonymous user generates the event for example a user clicks a button, the JavaScript is called and an XMLHttpRequest object is created which is set up with the request parameter contains the event generated component ID and the value (if any) user have entered. JavaScript interact with the browser and the XMLHttpRequest object exchanges the data between client and server asynchronously. On web server an object receives the request and take action on it. The object on web server responsible for acting on the request returns the updated value (if any) into an XML document then the XMLHttpRequest object receives this XML document and take the appropriate action on it and then it updates the HTML DOM (page from where the request was made) with new data.
There are various of web frameworks available for developing application based on Ajax technology. These can be of different types based on their features. These are as follows :
- Direct Ajax frameworks
- Indirect Ajax frameworks
- Ajax Component frameworks
- Server-driven Ajax frameworks