What is Ajax?why should we use it-trickcode

What is Ajax?,why should we use it
Share it:
What is Ajax?

AJAX-enabled web applications to retrieve data from the server asynchronously let's understand this term asynchronously first let's understand synchronous request-response cycle, for instance, the button click event handler takes 10 seconds so in a synchronous request-response cycle when we click the button a request is sent to the server and the server is going to ten-second takes a 10 seconds to process that blocked the user cannot do anything with that application so basically here in asynchronous request-response cycle the user interface is blocked while the request is being processed by the server so that is synchronous request-response cycle whereas during an asynchronous.
request-response cycle the client makes a request and then the client is freed up immediately so while the server is processing the request the client is not blocked the client is not waiting for the response to come back instead in an AJAX-enabled web application on the client we will have a JavaScript function waiting and listening for that response to come back but then the client itself is freed up so if the end-user wants he can issue another request so the application remains responsive while the requests are still being processed by the server as soon as the silver completes processing and when the response is sent back to the client the JavaScript method that's waiting for that response to come back will automatically update the UI so in an asynchronous request-response the applications are more responsive because they are not blocked and waiting for the response to come back and these AJAX-enabled web applications allow partial page.

What is Ajax?why should we use it

why should we use it

updates that's only the related section of the page is updated without reloading the whole page let's understand these partial page updates with an example so this is often often often the appliance that we've been working with within the previous session now check out this you recognize this page is already loaded so we've this HTML here now during a during a non Ajax application if you click on a button as an example what's gonna happen the page going to be are becoming to be posted back to the server then the entire HTML going to be are becoming to be reloaded another time as a result will have a screen flickers.
AJAX application inspect this once I click on the stop 3 link we get the very best 3 students and only this portion of the UI is updated not the whole page so as only some of the page is updated these are called as partial page updates let's actually prove that with Ajax we get partial page updates and to prove that so within the index page I'm getting to print the present date and time so slightly below this HTML h2 tag I'm going to print the present time and let's use date time object so day time dot now's going to give us the present date and time but we are only curious about time so let's use two long string method then let's use an HTML break..

So let me copy this same piece of code then piece that within the scholar partial view so almost this table tag I'm going to paste this alright let's plow ahead and run this now so when the page first loads inspect this this is often this time 1949-50 2 now once I click on this top 3 link inspect this now it is not getting to change so I click top 3 we get the very best 3 students and appearance at the time 1950 Oh 5 ok once I click bottom three again only this portion is updated you recognize check out this point this has not changed so with Ajax we get partial page updates and therefore the partial page updates you recognize the quantity of traffic that's exchanged between the client and the web server is additionally reduced because we aren't reloading that the whole HTML only the HTML that's relevant thereto section of the page is exchanged between the client and therefore the server alright so what are the advantages of ajax ajax applications are not any n-blocking.


Ajax requests are asynchronous the users doesn't need to await the request processing to finish even while the request remains being processed by the server the appliance remains responsive and the user can still interact with the appliance when the request processing is complete the interface is automatically updated but this is not the case with synchronous requests the interface is blocked and the user cannot do anything while the request remains being processed at the server side and with Ajax we also recover performance and reduced network traffic.
What is Ajax?why should we use it

Ajax enables an application to send and receive only the info that's relevant as a result that's reduced traffic between the client and the server and since of that we also recover performance and there are no screen flickers and again due to partial page updates you're not reloading the whole page only the info that's relevant thereto request in response is exchanged between the client and the server and only some of the page is updated and as a result we do not have screen flickers

so what are the disadvantages of using ajax request cannot be bookmarked easily now look at this I have already bookmarked this request so let me go ahead and get rid of that bookmark first so let me open up the browser and delete this bookmark that's already there right let's navigate to the index view let's run and I want to bookmark this page so in Google Chrome we click on that star and I'm going to bookmark that so now if I open another browser and I look at that I have the bookmark so when I visit that bookmark what do I want you to know a page like this to be loaded.

 so Ajax requests cannot be bookmarked you won't get the data that you actually bookmarked look at this here I bookmarked you know this page which is displaying top three students but when I clicked on that bookmark you know I don't have those top three students I have to again click on this link and Ajax relies on JavaScript.
so if javascript is disabled on the client browser Ajax applications won't work naturally and these are harder to debug as well because of asynchronous request response cycle so if there is a problem and you have to debug the problem you know Ajax applications are slightly complex to debug and search engines like Google Bing Yahoo etc cannot include.
 Ajax pages in their search index and what are the applications that are out there that are currently using Ajax many websites like Google Facebook all of them uses Ajax for example you know search engines like Google Bing YouTube Yahoo etc they use Ajax to implement autocomplete feature for example if we go to google look at that as we start typing here are for example difference you know we get autocomplete feature and how is this implemented this can be very easily implemented using Ajax .
What is Ajax?why should we use it

also uses Ajax to implement autosave feature now if you are composing an email if you are composing a lengthy email you recognize whatever content that you simply type into that email gets automatically saved okay so if there's an influence loss and if your system has shut down you know the data that you have typed is is retail because it's automatically saved okay so to implement.

 autosave feature again we can use Ajax and Gmail also uses Ajax to implement a foreign validation for instance if we attend Gmail we've that make account button so once I click on this create an account button and let's say here I use user name could think that so this user name is already used I'm using this so look at this as soon as I type you know tab away someone already has that user name try another how are we getting this.


Share it:

Ajax

Post A Comment:

0 comments: