I’d like to create a js for a dynamic location

Featured Imgs 23

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>

JS SCRIPT NOT RUNNING

Featured Imgs 23

I am creating a basic page in w3spaces and while I've finished editing the html and css part, I'd like to add a few scripts in it. I tried to add this script (https://www.w3schools.com/howto/howto_js_countdown.asp), which is a countdown timer to my own page but it seems like it doesn't run. Initially I used the code provided <p id="demo"></p> and nothing happened. I also tried other things such as <span id="demo" class="demo"></span> and <script src="./countdown.js"></script> but neither worked. Do you have any suggestion please as I am not very experienced.