JSFiddle - React, Tailwind, and code Playground

HTML

<p id="language"><i>Click 'Get language' to update this field</i></p>
<button id="get_language">Get language</button>

CSS

p {
    margin: .5em;
    padding: .5em;
    border: 1px solid #ccc;
}
button {
    margin: .5em;
    padding: .5em;
}

JavaScript

var language = '';

$('#get_language').click(function() {
    $.ajax({ 
        url: "http://ajaxhttpheaders.appspot.com", 
        dataType: 'jsonp', 
        success: function(headers) {
            // Get the language from the response:
            language = headers['Accept-Language'];
            $('#language').text(language);

            // Also put the first two characters of the language on a new line:
            $('#language').append("<br />" + language.substr(0, 2));
        }
    });
});