So i'd like to have a text saying [Location] which will be shown and changed based on the viewer's location/ip. I tried to follow this video here https://www.youtube.com/watch?v=1KiGKd2XXL4 but i didn't manage to make it to work. I registered on 2 websites to get an API key which i placed it in the script and yet it didn't work out. What I tried in a nutshell is
<script>
$('document').ready(function() {
$.ajax({
url: "https://api.snoopi.io/check?apikey=MY API KEY",
dataType: "jsonp",
jsonpCallback: "unBounce"
});
}); // Ready
function unBounce(json){
$('#location').html(json.City + ", " + json.State);
}
</script>
Followed by
<span id="location"></span>