Newer
Older
Digital_Repository / Repositories / Maps / css_map.js
  1. // Global XMLHttpRequest object.
  2. var httpRequest = new XMLHttpRequest();
  3.  
  4. function load( startMillis, numEntries, showOnly, eprintIDs )
  5. {
  6. // Open the request. Setting the third argument to TRUE makes the
  7. // request asynchronous, i.e., the browser doesn't wait.
  8. httpRequest.open('GET', 'css_map.pl?width=1024&height=520&top=' + numEntries
  9. + "&show=" + showOnly + "&eprint=" + eprintIDs, true);
  10. // When we hear something from the server, call the handleResponse()
  11. // function to find out what happened.
  12. httpRequest.onreadystatechange = function ()
  13. {
  14. if(httpRequest.readyState == 4)
  15. {
  16. if (httpRequest.status == 200) // Did it work?
  17. {
  18. // Grab the response content.
  19. document.getElementById( "map" ).innerHTML = httpRequest.responseText;
  20. // Grab finishing time. We have to do this here rather than in
  21. // the main part of the load() function because the map data
  22. // are generated asynchronously.
  23. var endTime = new Date();
  24. document.getElementById( "timer" ).innerHTML =
  25. 'Page generated in ' +
  26. ( endTime - startMillis ) +
  27. ' ms.';
  28. }
  29. else
  30. {
  31. // Do some sort of error handling.
  32. }
  33. }
  34. };
  35. // Send the request.
  36. httpRequest.send(null);
  37.  
  38. }