Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function applyCrashNodes(person)
- {
- document.getElementById("nodeWrapper").innerHTML = "";
- console.log(person);
- }
- function applyNameNodes(json)
- {
- var nodeType = "node";
- var nodeInterval = 1;
- var nw = document.getElementById("nodeWrapper");
- json = JSON.parse(json);
- for(var i = 0; i <= json.length - 1; i++)
- {
- if(nodeInterval == 3)
- {
- nodeInterval = 1;
- }
- if(nodeInterval == 1)
- {
- nodeType = "node";
- }
- else if(nodeInterval == 2)
- {
- nodeType = "nodeG";
- }
- nw.innerHTML = nw.innerHTML + "<div class='" + nodeType + "' id='" + i + "'><div class='nodeName'>" + json[i][0] + "</div></div>";
- nodeInterval++;
- document.getElementById(i.toString()).addEventListener("click", function(event)
- {
- console.log(event);
- });
- }
- }
- window.onload = function()
- {
- var cnt = document.getElementById("nodeWrapper");
- cnt.innerHTML = "";
- document.getElementById("ld").style.display = "block";
- var xhttp = new XMLHttpRequest();
- xhttp.onreadystatechange = function() {
- if (this.readyState == 4) {
- if(this.status == 200)
- {
- document.getElementById("ld").style.display = "none";
- console.log(this.responseText);
- applyNameNodes(this.responseText);
- }
- else
- {
- console.log(this.status);
- document.getElementById("ld").style.display = "none";
- }
- }
- };
- xhttp.open("GET", "http://messagenr.esy.es/driving.php?action=pull", true);
- xhttp.send();
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement