JSFiddle - React, Tailwind, and code Playground
HTML
<div class="portalControls">
<button class="syncButton">Get</button>
</div>
JavaScript
$(document).ready(function() {
$(".portalControls").find(".syncButton").click(triggerSync);
});
var root = 'https://jsonplaceholder.typicode.com';
function triggerSync(e) {
e.preventDefault();
$.ajax({
type: "GET",
url: root + '/posts/1',
dataType: "text",
success: writeToConsole,
error: writeToConsole
});
}
function writeToConsole(consoleText) {
alert(consoleText);
}