Ajax Introduction
What is Ajax?

Ajax is stands for Asynchronous JavaScript And XML.
Ajax was introduced in 2005 by google.
Ajax is not programming language like  C++, Java etc.
Ajax is a technique for creating fast application without reloading page.
Ajax is combination of html, css, javascript and xml.
Using Ajax technique we feel our webapplication is like desktop application.

More About Ajax.

Ajax work asynchronously, which means ajax does not wait for data that is return from server, at this time ajax attend other tasks,
Ajax mainly work with XMLHttpRequest that is available in most modern broswers. using XMLHttpRequest object we are communicating with server behind the scenes.

Browser that support XMLHttpRequest
Mozilla, Firefox Internet Explorer 7+, Chrome, Opera, Safari

But some browser not support XMLHttpRequest object that is Internet Explorer 5/6
for this reason we use ActiveX Object for Ajax work.

Advantage of Ajax.

There is no need to buy extra software.
Whole page will not refresh only part of the page is refresh
We can access database from server without reloading page.
This is looking like desktop application.
Waiting time more reduced

Disadvantage of Ajax.

If JavaScript is not activated on your browser then Ajax can not works.
Anyone can view source code that is written for Ajax.
Ajax integration with every browser is not good.
Ajax code is complex that is more difficult to web developers.
Ajax application does not index on search engines like google,yahoo etc.
Data is URL-encoded so that that increased request.

Where we can see Ajax.

1. On Google Maps and Gmail.
2. When we search on Google. Google display list of suggestion.

Note:- first it is necessary to check your browser support Ajax or not.

Ajax engine block diagram

How we can do work through ajax?

For ajax work,Use XMLHttpRequest Object to check your browser support ajax or not. So for this purpose we use Javascript window object.

use window.XMLHttpRequest for Mozilla, Internet Explorer 7+, Chrome, Opera, Safari
use window.ActiveXObject for Internet Explorer 5/6.

Example 1:- Script to Check your browser support Ajax or not.

<title>Check Browser Support XMLHttpObject</title>
<script language="javascript">
function check()
            alert ("Your browser support XMLHTTPRequest Object");
            else if(window.ActiveXObject)
            alert ("Your browser support XMLHTTPRequest Object");
            alert("Your browser does support XMLHTTPRequest Object");
<input name="num" type="submit" value="Submit" onClick="check();" />