This is a small reference for all the developers who are new to AJAX.
Definition : “The method of exchanging data with a server, and updating parts of a web page — without reloading the entire page.”
Benefits of Ajax:
Ajax is used to perform a callback, making a quick round trip to and from the server to retrieve and/or save data without posting the entire page back to the server. It only sends the data to the sever that is necessary, this way it minimizes the network utilization and the operations are performed faster. By using callbacks the server is not required to process all the data hence there is limited data processing on the server.
- Asynchronous calls:
Ajax allows you to make asynchronous calls to a web server. This allows the client browser to avoid waiting for all data to arrive before allowing the user to act once more.
Because a page postback is being eliminated, Ajax enabled applications will always be more responsive, faster and more user-friendly.
- Increased speed:
The most important usage of AJAX is to improve the speed, performance and usability of web application. For instance, if we look at the example of Netflix, the ratings and preference of movies are stored in your database and for the particular function, the complete webpage is not reloaded instead only that particular block of rating is refreshed. This save time and also improves the usability of the application.
AJAX cannot work independently. It is used in combination with other technologies to create webpages.
DOM: Dom represents the structure of XML and HTML documents. It uses API for accessing and manipulating structured documents.
Steps of AJAX Operation
- A client event occurs.
- An XMLHttpRequest object is created.
- The XMLHttpRequest object is configured.
- The XMLHttpRequest object makes an asynchronous request to the Web-server.
- The Web-server returns the result containing XML document.
- The XMLHttpRequest object calls the callback() function and processes the result.
- The HTML DOM is updated.
Advances made to AJAX
The Ajax Control Toolkit is a suite of controls created by Microsoft that is integrated into Visual Studio and can be dragged and dropped onto web forms just like HTML and server controls. These controls are intended to be used for Ajax callbacks. However, they can also be used as normal client and or server controls. For example, Asp.Net does not come with the Tabs controls. However, the Ajax Control Toolkit does. The Tab control can postback to the server just like server controls.
- Mozilla Firefox 1.0 and above.
- Netscape version 7.1 and above.
- Apple Safari 1.2 and above.
- Microsoft Internet Explorer 5 and above.
- Opera 7.6 and above