There are some fast food outlets that start cooking food only after you walk up to the counter and order it. Make no mistake, these are the inefficient outlets. You end up waiting half an hour for your meal to appear and vow never to go the restaurant again because of the time it made you waste.
Switch to a well-organized fast-food outlet. Popular menu items are already waiting for you in the brightly lit 'keep warm' showcase. You walk up to the counter, order a burger with fries, the salesperson goes to the showcase, takes out a warm, packaged burger, takes out fries and gives them all to you in a jiffy.
AJAX is a strategy for giving you web pages in a jiffy. I can't but help thinking that Jesse James Garrett
, credited with being the brain behind AJAX, spent a lot of time at the best fast food outlets. Why? Because the AJAX strategy is uncannily similar to that used in a quality fast food establishment.
Let's think for a moment about how your browser (Internet Explorer, Firefox, whatever) fetches a web page for you. You type the URL for the page into your browser. Your browser sends a request to a computer on the internet (the 'server' at that URL) to send that page back. The server pulls the page out from its store of pages and sends it to your browser, which displays the page on your screen.
Usually you do not have to wait more than 15 seconds for the page to reach your browser and be displayed on your screen.
But sometimes it can take a whole half minute
(which is the same as 'forever' in Internet terms) to see your page. Usually this occurs in a situation where you have entered some data in a web page, sent it down the Internet to a server, and are expecting the server to process your data and send you back a result (an example is attempting to fetch images from certain online photo sharing sites).
But suppose your desktop had a program in it which anticipated what your next request could be, got that information ahead of time from the server, and kept it ready for your browser. When you did make the request, the information you wanted would be readily available in your desktop. You would not have to wait for it to be fetched from the server; the program gives it to your browser and it is displayed immediately.
Now think of the 'keep warm' showcase strategy in the fast food restaurant. You see the similarity in concepts?
When it pre-fetches data from the server, it uses a programming language called XML
The pre-fetching does not occur as a result of your request for a page. It happens at other times, perhaps while you are sitting back and viewing the last page that was sent. The pre-fetching is thus not synchronized
with your requests for pages. This is known technically as asynchronous
Hence the name A
for short. And guess what, Google Groups, Google Suggest, and Google Maps are all implemented with AJAX.
It is likely that AJAX is going to show up more frequently in the design of interactive websites in the coming years. The next time you visit a fast-food restaurant, you may want to keep this in mind while collecting your order. How's that for living in two dimensions at once?
Lucky Balaraman is a graduate engineer and one of the founders of The Magnum Group, a leading web design and CAD service provider
based at Chennai, India.
Learn more about them at The Magnum Group
- Article Source