Source Code: (back to article)
<!DOCTYPE html>
<html>
<body>
<div>post title: <span id="spanId"></span></div>
<script>
function httpGet(theUrl) {
let xmlHttpReq = new XMLHttpRequest();
xmlHttpReq.open("GET", theUrl, false);
xmlHttpReq.send(null);
return xmlHttpReq.responseText;
}
document.getElementById("spanId").innerText = JSON.parse(httpGet("https://jsonplaceholder.typicode.com/posts/1")).title;
</script>
</body>
</html>