Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
<html>

<head>

    <script>
        function httpGet(theUrl) {
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.open( "GET", theUrl, false );
            xmlHttp.send( null );
            return xmlHttp.responseText;
        }


        function pageLoad() {
            var json = httpGet("/services/qbit-admin/load-nodes");
            var items = JSON.parse(json);
            var list = document.createElement("ul");
            for (var index=0; index< items.length; index++) {
                var serviceNode = items[index];
                var elem = document.createElement("li");
                var span = document.createElement("span");
                span.textContent = "" + serviceNode.name + " " + serviceNode.status;
                elem.appendChild(span);
                list.appendChild(elem);
            }

            var listDiv = document.getElementById("list");

            listDiv.appendChild(list);
        }


    </script>

</head>
<body onload="pageLoad();">
<h1>Admin</h1>



<div id="list"></div>


</body>
</html>
New to GrepCode? Check out our FAQ X