Basics of Ajax
page 1 of 5
Published: 18 Sep 2007
In this article Debjani describes everything that one needs to learn about AJAX starting with what AJAX is, how to make an HTTP request and handle a response, the advantages and disadvantages of using AJAX, and when to use and when not to use AJAX.
by Debjani Mallick
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 34703/ 29


Ajax is the shorthand notation for Asynchronous JavaScript and XML. It is a web development technique that is used for developing interactive web applications. Ajax develops interactive web application by sending a small amount of data to the server behind the scenes. The advantage of this is that the entire page is not reloaded every time when the user makes some changes in the input. It may seem that Ajax is some new technology. But that is not true. It is a new way of combining old technologies and representing them in a new way.

·         XHTML and CSS - for presentation

·         Document Object Model (DOM) - for dynamic display and interaction

·         XML and XSLT - for data interchange and manipulation

·         XMLHttpRequest - for asynchronous data retrieval

·         Java Script - for binding everything together

Before going deep into Ajax, let us discuss some basics of web applications. When a person sits down to develop an application, he has two choices before him.

·         Desktop application

·         Web application

Desktop applications normally come on a CD or are sometimes downloaded from some web site and are installed completely on the computer. Desktop application may use Internet sometimes to download some updates, but the code which is responsible for running those applications reside on the desktop only. On the other hand, Web applications run on a Web server which is present somewhere else and a person accesses those applications with the help of his browser.

Desktop applications are pretty fast since they do not require any Internet connection to run and they have great user interfaces. They are also incredibly dynamic. A person can pull up menus and sub-menus and can do many more things without waiting for anything. And this feature is almost opposite to what happens in a web application. No doubt that the services provided by Web applications can never be provided by any desktop application, but it is also true that the user has to wait for everything in a Web application. Since Web applications use an Internet connection they are normally slower that desktop applications. A user has to wait to get a response back from the server, for the web page to get refreshed, etc.

Now coming down to our topic, normally what happens in most of the classical web application is that any user request sends a HTTP request to a web server. The server does some processing to give back the response and then returns an HTML page to the user. But every time the user submits the page to the server, the server responds with a totally new page which makes the application run slower and is less user-friendly. An Ajax application eliminates this disadvantage by incorporating a middle layer between the user and the server. That intermediate layer is the Ajax engine.

Actually, what happens here is that instead of loading a web page, at the start of the session the browser loads the Ajax engine. The Ajax engine is written in JavaScript and is usually placed in a hidden frame. This engine is responsible for communicating with the server and the user; i.e. it acts as the link between the server and user machine. The Ajax engine allows asynchronous interaction of the user with the application, independent of communication with the server. So here, the user does not have to keep waiting for the response from the server. In Ajax every user action that would create any HTTP request takes the form of a JavaScript call to the Ajax engine. Any user request that can be fulfilled by the engine is done by the engine itself without bothering the server. But any user request which requires the server interference, the engine makes those requests asynchronously, usually using XML, without stopping the user interaction with the application.

View Entire Article

User Comments

Title: hai   
Name: bala
Date: 2012-08-28 12:51:06 AM
hello how r u
Title: Sundar   
Name: Sundar
Date: 2011-05-29 11:31:33 AM
Yes, Ajax Is Really Very Easy. But It Is Very Hard TO Learn
Title: fantastic explanation   
Name: harish Solanki
Date: 2010-12-12 11:57:30 PM
it is a great article and after reading this now i am able to understand how ajax works.
Title: Excellent   
Name: clhenter
Date: 2009-09-28 9:48:45 AM
Excellent article.
Title: Keeping it simple   
Name: Fat Limbaugh
Date: 2009-05-31 8:36:26 PM
You did a good job of keeping it simple and straight forward
Title: all   
Name: jagadish jadhav
Date: 2009-01-10 5:29:08 AM
I really thanks to this site owner. it is ever made site for the bignner programmer.
Title: Helpful for Begineers   
Name: Md. Mostafijur Rahman
Date: 2008-08-31 1:26:57 AM
Easy to understand..simply nice...
Title: Article on Ajax   
Name: narendra
Date: 2008-07-16 5:50:51 AM
Nice article
Title: Good to know about ajax for beginners   
Name: Harikrishna
Date: 2008-07-01 7:28:32 AM
This article is very good. Basic idea how Ajax works? simple to understand.
Title: Mind Blowing   
Name: Surendra
Date: 2008-05-22 8:51:38 AM
I am new to AJAX and find very comfortable with this article
Title: excellent   
Name: susan
Date: 2008-04-11 9:40:13 PM
Wow that was a nice explanation for a newbie to AJAX. Thanks for keeping it simple and easy to understand!
Title: Very Nice   
Name: chirag Panchal (MCA)
Date: 2008-03-28 8:20:34 AM
I'm new to AJAX I found this article is very interesting and useful.Thanks a lot.
Title: Really Good   
Name: Prabhakar reddy.D
Date: 2008-02-29 12:49:10 AM
I'm new to AJAX I found this article is very interesting and useful.Thanks a lot.
Title: fruitful, really wonderful   
Name: kanagaraj.P
Date: 2008-02-25 4:04:33 AM
im very much interested to learn new tech'y. i lve AJAX. I don't knw where to get started, i got tis site. very much informative. Can i get more detailed things abt ajax./.? please help me out to become familiar..
My e mail id:
Title: Very Useful   
Name: Nandagopal
Date: 2008-02-01 1:01:38 PM
I'm new to AJAX I found this article is very interesting and useful.Thanks a lot.
Title: Fruitful Article   
Name: Praveen Kumar emw
Date: 2008-01-29 7:41:22 AM
This atricle is very useful.It clears my doubts relating where should AJAX use and where shouldn't.
Thanx a lot.
Title: Ajax   
Name: Ravi
Date: 2007-12-05 12:20:46 PM
This Article is good but give example with Asp.Net
.aspx pages
Title: Informative Article   
Name: Ravinder Saini
Date: 2007-11-25 8:25:47 AM
Please send me info on AJAX.I need to start developing using ASP.Net with AJAX very soon.

Name: asim
Date: 2007-11-22 10:34:49 AM
exellent article thanks.
Title: good 2 see   
Name: prashanth
Date: 2007-09-20 7:03:12 AM
good 2 all
Title: AJAX - a Detailed Insight   
Name: Balaji
Date: 2007-09-18 11:59:24 PM
HATS OFF to Debjani Mallick.
Such a detailed insight in a simple language with easy examples..........
I request you to post more and more articles........
Title: Re: security disadvantage?   
Name: Debjani Mallick
Date: 2007-09-18 11:44:50 AM
In actual, due to security constraints XMLHttpRequest can only be used to access information from the host that served the initial page. If we need to display information from another server, it is generally not possible within the AJAX paradigm. XMLHttpRequest applies a restriction policy to the same origin. This kind of control will
deny any request made outside actual host,
considering port and protocol.
Title: ...........   
Name: john simpson
Date: 2007-09-18 6:00:02 AM
I am new to AJAX and I was wondering for some good information on Ajax. But when i went through your article, i really feel assured and now i can proceed for some AJAX stuffs.

I really feel thankful to you, for publishing such a managed article.
Title: security disadvantage?   
Name: K. Winter
Date: 2007-09-18 4:25:08 AM
Thanks for the article, it was useful. Can you shed some more light on the disadvantage that you noted:
"Another disadvantage lies in the xmlHttpRequest object itself because one can use it to access information from the host that served the “initial page” (due to security reasons)."

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-20 8:48:34 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search