JSFiddle - React, Tailwind, and code Playground
JavaScript
// Utilize the JSONP API
$.getJSON('http://www.geoplugin.net/json.gp?jsoncallback=?', function(data){
var region = data['geoplugin_region'];
var country = data['geoplugin_countryCode'];
if(country == 'US' && region == 'CA')
{
console.log("In CA");
}
else
{
console.log("In " + region + ", " + country);
}
});