const request = new XMLHttpRequest(); request.open("GET", "https://api.datacommons.org/stat/value?place=country%2FBIH&stat_var=Count_Person&measurement_method=BosniaCensus", false /* async */ ); request.send(); if (request.status == 200) { let result = JSON.parse(request.responseText); console.log(result); document.getElementById("result").innerText = result["value"]; } else { console.log("There was an error fetching data."); }
<p> Count of people in <a href="https://api.datacommons.org/stat/value?place=country%2FBIH&stat_var=Count_Person&measurement_method=BosniaCensus">Bosnia</a> according to the Bosnia Census: <span id="result"></span> </p>