JSFiddle - React, Tailwind, and code Playground
by Mon Cervantes
HTML
<div id="ip">Loading...</div>
<div id="country_code"></div>
<div id="CA">Hello Canada</div>
<div id="US">Hello USA</div>
CSS
#US { text-align: left; color: blue; display:none;}
#CA { text-align: left; color: blue; display:none;}
JavaScript
$.get("http://freegeoip.net/json/", function (response) {
$("#ip").html("IP: " + response.ip);
$("#country_code").html(response.country_code);
var country = response.country_code;
if(country == 'US' || country == 'CA') document.getElementById(country).style.display = "block";
}, "jsonp");