Define Ajax
Ajax is a client-side script that communicates to and from a server or database without the need for a postback or a complete page refresh.
Ajax is “the method of exchanging data with a server, and updating parts of a web page - without reloading the entire page.
How it works?

In this way an ajax script will work.
Ajax is a client-side script that communicates to and from a server or database without the need for a postback or a complete page refresh.
Ajax is “the method of exchanging data with a server, and updating parts of a web page - without reloading the entire page.
How it works?
In this way an ajax script will work.
Please elaborate XMLHttpRequest Object further?
The XMLHttpRequest object is used to exchange data with a server behind the scenes. The XMLHttpRequest object is the developers dream, because you can: Update a web page without reloading the page.
JavaScript uses this Object to exchange XML as well as text data between client and server. An AJAX implementation uses this object and communicate with server but it doesn't require the complete page to be refreshed.
How to send a request to server using XMLHttpRequest Object?
We can send a request to server using HTTP GET and POST methods.
// Simple GET Request
var
xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", "TestFile.txt",
true);
xmlHttp.send();
//Simple POST Request
var
xmlHttp = new XMLHttpRequest();
xmlHttp.open("POST", "TestFile.txt",
true);
xmlHttp.send();
What is ASP.NET AJAX?
Microsoft simplified the usage of these techniques with its own implementation. ASP.NET AJAX is a set of extensions to ASP.NET and comes with reusable AJAX controls. Using ASP.NET AJAX, we can develop applications that can update partial page instead of a complete page refresh.
Difference between Synchronous and Asynchronous Postback?
Synchronous Postback
|
Asynchronous Postback
|
|
complete web page is sent to server and in
return rendering the output
|
partial page goes to the server and renders
only partial (required) part of the page.
|
|
synchronous postback executes all the actions at once.
|
Asynchronous postback executes only one
postback at a time, that is, if you have two buttons doing asynchronous
postback, the actions will be performed one by one
|
|
Synchronous postback modifies the entire page.
|
Asynchronous postback only modifies the
update panel that raises the postback
|
What are the basic controls in ASP.NET AJAX?
Following controls can be considered as core AJAX controls in ASP.NET.
- ScriptManager
- ScriptManagerProxy
- UpdatePanel
- UpdateProgress
- Timer
Later more controls are added to ASP.NET AJAX library e.g. Script Loader, Client Data Context, Client Data Access, jQuery Integration etc.
What is a ScriptManager in ASP.NET AJAX?
In order to use AJAX functionality on a web page, we add a ScriptManager control to the page in most of the scenarios, because ScriptManager control register AJAX library scripts to that particular web page.
ScriptManager Vs ScriptManagerProxy?
As we understand that we can have only one ScriptManager control on a page but we can have multipleScriptManagerProxy controls. Consider a scenario that we have ScriptManager in our MasterPage that is available for all content pages. Now, we wanted to register a web service in a particular page. So, we will not add another ScriptManager to that page instead we will add ScriptManagerProxy to it in order to avoid error
What is the role of UpdatePanel in ASP.NET AJAX?
UpdatePanel is the control that facilitate the partial page rendering functionality in an ASP.NET application. As discussed earlier that using ASP.NET AJAX, we can communicate with a web server asynchronously and update a part of a page without a complete page postback.
What are the limitations of AJAX?
- AJAX on an application will not work if JavaScript is disabled.
- In some scenarios, it exposes vulnerability.
- It will always be difficult to bookmark application state.
- Application behavior may be slow in some scenarios, because of different loading time of controls on a single page.
No comments:
Post a Comment