Abstract
AJAX stands for Asynchronous JavaScript and XML. It is a web technology that evolved in early 2000 and uses a mix of technology like JavaScript and XML. This paper discusses about how AJAX technology works in modern web application and various advantages and disadvantages. This paper also discusses about various frameworks available for AJAX that can be used on different platforms.
History
In the past, when there was no such thing as AJAX, the websites needed to reload each and every time for retrieving even small bits of information from the server or processing a tiniest client request, which made the webpages very inefficient. Every time there is a page refresh, it put consumed some bandwidth and put some load on the request processing server. In order to overcome this cycle of request-response, and fetch required data from the server without having to make a round trip, Microsoft came up with iframe technology is as early as 1999 but it was clunky and not efficient. The core of today’s AJAX technology, known as XMLHTTP object was first implemented by Microsoft Outlook in 1999. The term “AJAX itself was first used my Jesse James in one of his articles in 2005 to talk about this new technology. W3C came up with its first round of documentation for the XMLHttpRequest and called it a web standard in 2006.
Classic web application vs. Ajax web application
AJAX has transformed how people view at webpages from a simple HTML document into a dynamic web application. The early web sites rendered the webpage as a plain HTML pages. It lacked features like dynamic updates and synchronization with services and servers. The web server in classic web applications performed all the serving up responses to requests with each round trip. Due to this overhead of constant server round trips, web sites in the early 2000 performed poorly and were not as dynamic in terms of updates and synchronization.
On the contrary, AJAX based web sites perform better in terms of faster rendering and quicker updates. Not all the data processing is done on the sever side, as a connection is silently made to the server in the background which responds back by giving back the required data in some format like XML or JSON. The resulted data is then formatted using XSLT or CSS in the client side for a better rendering of the view.
The diagram below shows how websites in the past differ from modern web sites that make use of AJAX technology: (Ajax: A New Approach to Web Applications, J. Garrett, 2005)
What is AJAX?
AJAX is a modern web technology that leverages a bunch of existing web technologies to create faster and more efficient web applications. AJAX frees web sites from the need to post the whole webpage back to the server for small piece of information and lets pages or parts of a page update by receiving small chunks of data from the server magically behind the scene – without users barely noticing the page refresh. This is what is referred to when people talk about the “Asynchronous” behavior of AJAX. In a tradition sense, a classic web site always has to have an event send some kind of request to the server which will then result a response being sent back to the client from the server. That usually means, only one request can be responded at a time and any subsequent request have to wait until the previous requests have been processed by the server. When a user clicks on a button, that will trigger some kind of event resulting in either post or get request to the server, which will need to be processed by the server first and then the right view is served up to the user. Now this can happen behind the scene without the browser needing to do a complete post back to the server. The advantage of asynchronous call is that data can still be requested from a server without a complete post back to the server and all happens behind the scene and the user is barely affected by what is going on behind the scene. Instead of having to wait for the response result, pages or even parts of a page load asynchronously.
What make up AJAX?
AJAX is not a new programming language, nor is it just one new technology. It is rather a mix of existing technologies. The following make up the AJAX:
XMLHttpRequest object has following six methods
There are six important properties of the XMLHttpRequest object:
0: The request has not been initialized.
1: The AJAX call has established connection to the server.
2: request received: The AJAX call request has been received by the server.
3: The AJAX call request is being processed.
4: The AJAX call request has completed and the response is ready.
Ajax Event life cycle
The below diagram show the lifecycle of AJAX events in a web application (AJAX – Asynchronous JavaScript and XML, Saikrishna, 2009):
When a user visits an AJAX web site, the engine is first loaded and initialized before any AJAX related operation. The Ajax engine basically works around the two processes shown in cyan boxes in the above picture. The lifecycle of an AJAX operation is as follows:
Ajax Frameworks
Like any other web application framework, people have developed various frameworks around AJAX so that an these frameworks can be used on a specific platform, with a specific language etc. and basically provides API for developers to easily make use of AJAX technologies in more efficient and abstracted manner. These frameworks have unique components to accept request or process request using AJAX and are adapted to a particular language platform like ASP.NET or PHP etc. There are many AJAX frameworks for different platforms and languages. Some of the notable AJAX frameworks are listed below:
For .NET web applications:
For PHP web applications:
For Java web applications:
For JavaScript based web applications:
Real World Usage of AJAX:
Real world Users of AJAX
There are many web sites and applications that use AJAX nowadays. The most prominent and early adopters are sites like YouTube, Google maps, Gmail, Facebook etc. Facebook seems to have great implementation of AJAX as the posts and updates are show almost instantaneously and doesn’t need any page refresh. AJAX implementation in Facebook site is what does the trick in instant updates of user status, messages etc. A Google map is one of the oldest and the most popular AJAX based web application. The Google map fetches XML data of the places a user is looking for and transforms the received data into complex map imagery. Users can drag locations around or zoom in and out and the page doesn’t have to reload to reflect the new changes. Gmail also uses AJAX for variety of useful features like spell check, auto save incomplete as drafts, fetching new emails etc. Flickr uses AJAX in its site for loading pictures in a picture carousel manner where when a user clicks for next picture, there is no page refresh, the click of the next button simply fetches the next pictures and presents the user with the next picture – which makes perfect sense because there is not really a need to refresh the whole site to just to retrieve one photo in a current sequence of photos.
Advantages and disadvantages
AJAX has become a vital aspect of modern web application. AJAX has many advantages but it does also have some disadvantages. Here are some advantages and disadvantages of AJAX:
Advantages:
Disadvantages:
Summary
Ajax is a great technology and should be used when sites have a lot of plugins on a page and each need to refresh dynamically. AJAX makes a site more dynamic and performance is improved significantly as it cuts down on the number of post backs the page has to go through. It is also important to know that AJAX has its own advantages and disadvantages. It is important to distinguish which web applications require AJAX and which ones can do without it. Very simple web pages with very little data interactivity can probably do away with AJAX. Developers should always focus on the requirements of the site and wisely if AJAX is necessary or not to match the requirement.
References
Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.
You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.
Read moreEach paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.
Read moreThanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.
Read moreYour email is safe, as we store it according to international data protection rules. Your bank details are secure, as we use only reliable payment systems.
Read moreBy sending us your money, you buy the service we provide. Check out our terms and conditions if you prefer business talks to be laid out in official language.
Read more