Guest User

Untitled

a guest
May 16th, 2018
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. for (i = 0; i < length; i++) {
  2. (function(i) {
  3. // new XMLHttpRequest
  4. xhr[i] = new XMLHttpRequest();
  5. // gets machine url from href tag
  6. url = rows[i].getElementsByTagName("td")[0].getElementsByTagName('a')[0].getAttribute('href');
  7. //Insert the desired values at the end of each row; will try to make this customizable later as well
  8.  
  9.  
  10. insertVNC[i] = rows[i].insertCell(-1);
  11. insertSerial[i] = rows[i].insertCell(-1);
  12. insertVersion[i] = rows[i].insertCell(-1);
  13. insertFreeDiskSpace[i] = rows[i].insertCell(-1);
  14.  
  15. // the fun part: this function takes each url, loads it in the background, retrieves the values needed, and then discards the page once the function is complete; In theory you could add whatever you want without taking significantly longer as long as it's on this page
  16. console.log(i);
  17.  
  18. xhr[i].onreadystatechange = function() {
  19. if (xhr[i].readyState == 4 && xhr[i].status == 200) {
  20.  
  21.  
  22.  
  23. }
  24.  
  25. };
  26.  
  27. //"Get" the "Url"... true means asyncrhonous
  28. console.log(url);
  29. xhr[i].open("GET",url,true);
  30. xhr[i].send(null);
  31.  
  32. }) (i); //end for loop
  33.  
  34. }
Add Comment
Please, Sign In to add comment