We use “http” protocol for handling the communication between client and server.
Ajax has been introduced in the similar manner to send and receive response to and from web server using http, but the actual benefit of using Ajax adds more in way the request and response is handled.
In traditional way of sending and receiving request and response, if we consider a normal aspx page,
When user clicks on some button in aspx page to get some response, the entire page is reloaded when the response is received.
I mean though the response in deed is not required to refresh the whole page but just to update a part of page (a label control for example available among several controls), it is not really use full to reload the content of each and every control which are not required.
Ex:-
I have created an aspx page whose interface look like
When I request for this page,
user clicks on “Yesterdays button”, it is really required to just update the “lblYes” label to display “Yesterdays date” but not required to reload the entire page and update the other 2 components (Today’s date button and Today’s date label), similarly when user clicks on “Today’s date” button.
You can also see the entire page is post backed and reloaded, when user click on any one of these buttons.
This is traditional process,
Ajax helps at this kind of instants.
When user clicks on today’s button, we can handle the request and response using Ajax to update only the today’s label instead of reloading the entire page and updating the other 2 components (Yesterday’s date button and Yesterday’s date label) though not required.
Obviously, there are 2 advantages here
1) User can fell the page is not getting post backed.
2) Since the response is not reloading the entire page but only updating or refreshing a part of page, it does not take much time when compared to reloading the entire page.
No comments:
Post a Comment