JSFiddle - React, Tailwind, and code Playground
by Mykola Senyk
HTML
<h1>There are <span>?</span> people in our community</h1>
<button id="refresh">Refresh</button>
CSS
span {
color: green;
}
JavaScript
$(function() {
var url = 'http://premium-api.com/dyn/usersStat';
function updateCounter() {
console.log('event start');
$.getJSON(url, function(data) {
console.log('we get data');
$('h1 span').text(data.count);
});
console.log('event stop');
}
$('#refresh').on('click', updateCounter);
});