JSFiddle - React, Tailwind, and code Playground
HTML
<div id="time">Click the button</div>
<button id="gettime">Get the time</button>
JavaScript
$("#gettime").click(function() {
setInterval(ajaxCalltoGetTime, 1000);
});
function ajaxCalltoGetTime() {
$.ajax({
type: "GET",
url: 'http://json-time.appspot.com/time.json',
dataType: 'jsonp'
})
.done(function( msg ) {
$("#time").html(msg.hour + ":" + msg.minute + ":" + msg.second );
});
}