JSFiddle - React, Tailwind, and code Playground

HTML

<!DOCTYPE html><html>
<head>
</head>
<body><button onclick="doAjax();">Do AJAX</button></body>
</html>

JavaScript

function doAjax()
{
    $.ajax({
        type: "GET",
        url: "http://www.non-existant-url.com/",
        success: function(data, textStatus, jqXHR){
            alert("Success");
        },
        error: function (xhr, textStatus, errorThrown) {
             console.log("xhr.status: " + xhr.status);
             console.log("xhr.statusText: " + xhr.statusText);
             console.log("xhr.readyState: " + xhr.readyState);
             console.log("xhr.responseText: " + xhr.responseText);
             console.log("xhr.responseXML: " + xhr.responseXML);
             console.log("textStatus: " + textStatus);
             console.log("errorThrown: " + errorThrown);
             console.log("xhr.redirect: " + xhr.redirect);
                },
        statusCode: {
            404: function () { console.log("404"); },
            501: function () { console.log("501"); },
            502: function () { console.log("502"); }
        }
    });
}

console = window.console || {};
console.log = function(msg)
{
    $("body").append("<p>" + msg + "</p>");
}