NinethSense oWnZ mE!: Praveen’s drawing book

Choose a Topic:

Fri
31
Mar '06

Ajax simpleeee….

Here is my simple ajax code…..

 
<div id=“divTxt”>&nbsp;</div>
 
<script language=“javascript”>
	var req = new XMLHttpRequest();
	req.open(“GET”, “test.html”,true);
	req.onreadystatechange = function () {
		document.getElementById(‘divTxt’).innerHTML = “Contents : “ + req.responseText;
	}
 
	req.send(null);
 
</script>
 
HTML Source - test.html
 
<html>
	<head>
		<meta http-equiv=“content-type” content=“text/html; charset=UTF-8″>
	</meta></head>
	<body>
		apple<br />
		orange<br />
		pencil<br />
		box<br />
		bottle<br />
		computer<br />
		cat<br />
		dog<br />
		fox<br />
		windows<br />
		linux<br />
		unix<br />
		freebsd<br />
		blah<br />
	</body>
</html>
 
This code is compatible with Mozilla based browsers only. Eg: Firefox for windows
The CodeProject Microsoft Developer Network Official ASP.NET Forums Microsoft .NET Framework Community Microsoft Most Valuable Professional Kidoos forums Microsoft Visual Studio Developer Home Professional Information Technology Solutions Microsoft Research Home Kerala Microsoft Users Group Community Website