Created
July 14, 2020 21:16
-
-
Save ihorduchenko/a562e1eb1fb566b47d9017d8c8f6762e to your computer and use it in GitHub Desktop.
Get country code using geolocation service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.getJSON( | |
'https://geolocation-db.com/json/0f761a30-fe14-11e9-b59f-e53803842572', | |
function(data) { | |
console.log(data); | |
if ( data.country_code === "US" || data.country_name === "United States" ) { | |
console.log('Is USA'); | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment