Newer
Older
Digital_Repository / Repositories / Maps / css_map.js
// Global XMLHttpRequest object.
var httpRequest = new XMLHttpRequest();

function load( startMillis, numEntries, showOnly, eprintIDs )
{
	// Open the request. Setting the third argument to TRUE makes the
	// request asynchronous, i.e., the browser doesn't wait.
	httpRequest.open('GET', 'css_map.pl?width=1024&height=520&top=' + numEntries
		+ "&show=" + showOnly + "&eprint=" + eprintIDs, true);
	
	// When we hear something from the server, call the handleResponse()
	// function to find out what happened.
	httpRequest.onreadystatechange = function ()
		{
			if(httpRequest.readyState == 4)
			{
				if (httpRequest.status == 200) // Did it work?
				{
					// Grab the response content.
					document.getElementById( "map" ).innerHTML = httpRequest.responseText;
					// Grab finishing time. We have to do this here rather than in
					// the main part of the load() function because the map data
					// are generated asynchronously.
					var endTime = new Date();
					document.getElementById( "timer" ).innerHTML =
						'Page generated in ' +
						( endTime - startMillis ) +
						' ms.';
				}
				else
				{
					// Do some sort of error handling.
				}
			}
		};
	
	// Send the request.
	httpRequest.send(null);

}