JSFiddle - React, Tailwind, and code Playground
by wisegorilla
HTML
<pre id="response"></pre>
<pre id="demo"></pre>
JavaScript
var country_name_global = null;
$.get("https://api.ipdata.co/?api-key=test", function (response) {
//$("#response").html(JSON.stringify(response, null, 4));
country_name_global = response.country_name;
}, "jsonp")
//once $.get is done, do this
.done(function() {
document.getElementById("demo").innerHTML = country_name_global;
});