JSFiddle - React, Tailwind, and code Playground

by slashingweapon

HTML

<p><a href="/echo/jsonp?var1=x&var2=y">Link 1</a></p>
<p><a href="/echo/html">Link 2</a></p>
<p><a href="/echo/json">Link 3</a></p>

JavaScript

$("a").each(function() {
    var elem = $(this);
    var jqx = $.ajax({
        type: 'HEAD',
        url: elem.attr('href')
    });
    jqx.done(function(data) {
        var desc = jqx.getResponseHeader('Content-Type');
        var bytes = jqx.getResponseHeader('Content-Length');
        if (bytes) {
            desc += ' (' + parseFloat(bytes) + ' bytes)';
        }
        elem.after(desc);
    });
});