i

ASP.Net A Complete Guide

Ajax [Asynchronous JavaScript and XML]

ASP.NET Ajax Overview

Before going into the deep of what Ajax, we will understand first why we need Ajax. We know there is a concept of 'Master page' in the asp.net, and its purpose is to have the common layout. But apart from this common layout, we need something that will update the part of the web page dynamically, and we can achieve this by using the concept of Ajax.

1. Ajax [Asynchronous JavaScript and XML]

 Ajax retrieves data asynchronously from the server it and this processing happen in the background only. Ajax uses XMLHttpRequest for exchanging the data asynchronously with a server.

Advantages of using the Ajax [Add image here]

  • Ajax sends the data to the server and process it in the background.

  • Page loading need not wait for the data because here data received after the page load.

  • It will update the web page without waiting for the loading time.

  • It reduces the travel time between the client and the server.

  • Open source JavaScript libraries available to use.

  • We can use JSON, which is much better than XML.

Ajax life cycle:

  • When we click on the button on that Ajax call, have written then an event triggers in a web page

  • An XMLHttpRequest object will be created by JavaScript and object sends a request to a web server

  • The server processes the request in the background

  • The server sends a response to the web page

  • The response will read by the JavaScript object and bind it to the control

  • The required operation gets complete like update the page

Below image displays the Ajax Toolkit: