JSFiddle - React, Tailwind, and code Playground

JavaScript

$.ajaxPrefilter(function( options, _, jqXHR ) {
  
    var xhrFactory = options.xhr;

    options.xhr = function() {
                    
        var xhr = xhrFactory.apply( this, arguments );

        xhr.onreadystatechange = function(){
            alert(xhr.readyState + '\n\n\n' + xhr.responseText);
            //log(xhr.readyState + xhr.responseText);
        };

        return xhr;
    };
});
    
function log(s) {
    $("body").append(s + "<br>");
}

function xhrStreaming() {

    $.ajax({
        type: "GET",
        url: '/echo/json',
        success: function(data) {
            log("ajax success");
        },
        error: function( _, _, e ) {
            log("ajax error");
        }
    });
}


xhrStreaming();