Click here to Skip to main content
15,901,205 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am using an xmlhttprequest function to call data from an external api. Here is script for this:

var xmlhttp = new XMLHttpRequest();
var url = "https://10.1.10.10:8080/ContentManager/api/rest/dashboard";

xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
var myArr = JSON.player(xmlhttp.responseText);
myFunction(myArr);
}
};
xmlhttp.open("GET", url, true);
xmlhttp.send();

function myFunction(arr) {
var out = "";
var i;
for(i = 0; i < arr.length; i++) {
out += '' +
arr[i].display + '

';
}
document.getElementById("player").innerHTML = out;
}

From here I want to display "player" in an html div.

What I have tried:

I have tried...

XML
{{xmlString}}
//inside the div
Posted
Updated 15-Apr-16 19:53pm

Json data can be treat like object of javascript

JSON Example[^]
 
Share this answer
 
Your
document.getElementById("player").innerHTML = out;
suggested that your want to display the output inside a div with id="player"
<div id="player"></div>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900