<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Ajax 2</title>
<meta http-equiv="Content-Type" content="text/xml; charset=utf-8" />
<style type="text/css" media="screen">

</style>

<script type="text/javascript">
<![CDATA[

function JSDoc() {
	var me = this;
	var req = null;
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}
	
	this.request = req;
	this.loadJSDoc = function (url, handler) {
		if (this.request) {
			this.request.open ("GET", url, true);
			this.request.onreadystatechange = function () {
				handler(me);
			};
			this.request.setRequestHeader("Content-Type", "text/javascript");
			this.request.send(null);
		}
	};
}

function initJS () {
	var newrequest = new JSDoc();
	newrequest.loadJSDoc("js/data.js", showData);
}

function showData(req) {
	req = req.request;
	if (req.readyState == 4 && req.status == 200) {
	
		var response = req.responseText;
		var jsonObj = eval ( "(" + response + ")" );
	
		var title = jsonObj.title;
		var url = jsonObj.url;
		
		var body = document.getElementsByTagName("body")[0];
		
		var p = document.createElement("p");
		
		var content = document.createTextNode(title + " is located at " + url);
		
		p.appendChild(content);
		body.appendChild(p);
		
		
	}
}

window.onload = initJS;
			



]]>

</script>

</head>

<body>

<p>The paragraph below should contain the name and the URL of &quot;CSS Test&quot;.</p>




</body>
</html>

