AJAX Example 2- Synchronous Communication using AJAX

//Program demonstrating Synchronous Communication using AJAX



<script type="text/javascript">

		var xmlhttp=false;

			xmlhttp=new XMLHttpRequest();
		else if(window.ActiveXObject)
			xmlhttp=new ActiveXObject("Microsoft.XMLHttp");

		function loadData(){




<div id="Div1">
<h2>Welcome to the world of AJAX</h2>


<button type="button" onclick="loadData()">Change Content</button>




AJAX= Asynchronous JavaScript and XML Allows for asynchronous communication between a browser (client) and server.
Does not mandate that the end user must wait for processing a request.
Can be used as an alternative to HTML forms in certain situations.

When the button is clicked then the request is sent synchronously to the server and the contents of ajax_info.txt are sent to the client.

Screenshot of the o/p


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s