JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test orgs</title>
<script src="main.js"></script>
</head>
<body>
<header>
</header>
<section>
</section>
</body>
</html>
JavaScript
var header = document.querySelector('header');
var section = document.querySelector('section');
var requestURL = 'http://127.0.0.1:3000/organizations.json';
var request = new XMLHttpRequest();
request.open('GET', requestURL);
request.responseType = 'json';
request.send();
request.onload = function () {
var organizations = request.response;
populateHeader(organizations);
}
function populateHeader(jsonObj) {
var myH1 = document.createElement('h1');
myH1.textContent = jsonObj['organization'];
header.appendChild(myH1);
var myParagraph = document.createElement('p');
myParagraph.textContent = 'Address is: ' + jsonObj['address'] + ', ' + jsonObj['addDetails'];
header.appendChild(myParagraph);
}