JSFiddle - React, Tailwind, and code Playground

by huston007

HTML

<button id="send">send err</button>
<button id="sendok">send ok</button>
<ul id="log">
</ul>

JavaScript

$("#send").on("click", function(){
    $.get("/echo/json").then(function(res){
        //let's imagine something happen
        throw "error";
    });
});

$("#sendok").on("click", function(){
    $.get("/echo/json").then(function(res){
        $("#log").append("<li>send ok</li>");
    });
});

$(document).on("ajaxStart", function(){
    $("#log").append("<li>start</li>");
});

$(document).on("ajaxStop", function(){
    $("#log").append("<li>stop</li>");
});