I just modified an HTML example with Json but it is of an array type and apparently what I want to use is an object, I believe this is the problem. json contains this information:
{"riotschmick": {"id": 585897, "name": "RiotSchmick", "profileIconId": 956, "summonerLevel": 30, "revisionDate": 1449128440000}}
I think there is something in the code to work Here is the example:
<!DOCTYPE html>
<html>
<body>
<h1>Meu Projeto</h1>
<div id="id01"></div>
<div id="id02"></div>
<script>
var xmlhttp = new XMLHttpRequest();
var url = "https://na.api.pvp.net/api/lol/na/v1.4/summoner/by-name/RiotSchmick?api_key=a15c56d1-fdd7-4da2-ad9c-0f1a6585ac1b";
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
myFunction(xmlhttp.responseText);
}
}
xmlhttp.open("GET", url, true);
xmlhttp.send();
function myFunction(response) {
var arr = JSON.parse(response);
var out = "<h1>";
out += arr.id + arr.name + arr.summonerLevel;
out += "</h1>";
document.getElementById("id01").innerHTML = out;
}
</script>
</body>
</html>