Advertisement
Guest User

DRECORD

a guest
Dec 30th, 2016
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function applyCrashNodes(person)
  2. {
  3.   document.getElementById("nodeWrapper").innerHTML = "";
  4.  
  5.   console.log(person);
  6. }
  7.  
  8. function applyNameNodes(json)
  9. {
  10.   var nodeType = "node";
  11.   var nodeInterval = 1;
  12.  
  13.   var nw = document.getElementById("nodeWrapper");
  14.  
  15.   json = JSON.parse(json);
  16.  
  17.   for(var i = 0; i <= json.length - 1; i++)
  18.   {
  19.     if(nodeInterval == 3)
  20.     {
  21.       nodeInterval = 1;
  22.     }
  23.     if(nodeInterval == 1)
  24.     {
  25.       nodeType = "node";
  26.     }
  27.     else if(nodeInterval == 2)
  28.     {
  29.       nodeType = "nodeG";
  30.     }
  31.  
  32.     nw.innerHTML = nw.innerHTML + "<div class='" + nodeType + "' id='" + i + "'><div class='nodeName'>" + json[i][0] + "</div></div>";
  33.  
  34.     nodeInterval++;
  35.  
  36.     document.getElementById(i.toString()).addEventListener("click", function(event)
  37.     {
  38.       console.log(event);
  39.     });
  40.   }
  41. }
  42.  
  43. window.onload = function()
  44. {
  45.   var cnt = document.getElementById("nodeWrapper");
  46.   cnt.innerHTML = "";
  47.  
  48.   document.getElementById("ld").style.display = "block";
  49.  
  50.   var xhttp = new XMLHttpRequest();
  51.   xhttp.onreadystatechange = function() {
  52.     if (this.readyState == 4) {
  53.       if(this.status == 200)
  54.       {
  55.         document.getElementById("ld").style.display = "none";
  56.  
  57.         console.log(this.responseText);
  58.  
  59.         applyNameNodes(this.responseText);
  60.       }
  61.       else
  62.       {
  63.         console.log(this.status);
  64.  
  65.         document.getElementById("ld").style.display = "none";
  66.       }
  67.     }
  68.   };
  69.   xhttp.open("GET", "http://messagenr.esy.es/driving.php?action=pull", true);
  70.   xhttp.send();
  71. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement