JSFiddle - React, Tailwind, and code Playground

HTML

<span id="myOnline"></span>

JavaScript

;(function(){
  getOnline();
  setInterval(getOnline, 1000 * 20) // 20 sec

  function getOnline() {
    var url = 'https://mcapi.ca/query/play.minesuperior.com/info'
    fetch(url).then(function(response) {
      var contentType = response.headers.get("content-type");
      if(contentType && contentType.indexOf("application/json") !== -1) {
        return response.json().then(function(json) {
          displayOnline(json.players.online || 'error')
        });
      } else {
        console.log("Oops, we haven't got JSON!");
      }
    });
  }

  function displayOnline(online){
    document.querySelector('#myOnline').innerHTML = online;
  }
})()