JSFiddle - React, Tailwind, and code Playground

by forloop

JavaScript

updatePerson().done(function(msg) {
    $('body').append(msg);
});

function updatePerson() {
    return $.ajax({
        type: "POST",
        url: "/echo/html/",
        data: {
            delay: 3,
            html: '<p>Update Succeeded!</p>'
        }
    }).promise();
}


window.setTimeout(function() {
    // add another callback aftera timeout
    updatePerson().done(function(msg) {
        $('body').append(msg);
    });
}, 5000);