demo.js 403 B

1234567891011121314151617
  1. var sys = require('util');
  2. var XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
  3. var xhr = new XMLHttpRequest();
  4. xhr.onreadystatechange = function() {
  5. sys.puts("State: " + this.readyState);
  6. if (this.readyState == 4) {
  7. sys.puts("Complete.\nBody length: " + this.responseText.length);
  8. sys.puts("Body:\n" + this.responseText);
  9. }
  10. };
  11. xhr.open("GET", "http://driverdan.com");
  12. xhr.send();