The script reveals the appropriate div if the user resides in a specific place with the help of MaxMind's database.

But, since I'm still getting my feet wet this little snippet of code I've put together just doesn't want to work.

What am I getting wrong here?

(edited with more info below - thanks everyone for the heads up about clarification! so helpful)

$geoip_city is a global variable provided by the MaxMind database. It returns a value based on the user's IP which corresponds to listed entries. In this case I'm looking for users in specific cities like Toronto or Vancouver.

$(document).ready(function(){
    if ($geoip_city() == $geoip_city('Vancouver')){
     document.getElementById('vizPlayer').style.display = "block";
    }else if ($geoip_city() == $geoip_city('Toronto')){
      document.getElementById('vizPlayer').style.display = "none";
    }
});
有帮助吗?

解决方案

This is how document.ready should look like

$(document).ready(function(){


});
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top