سؤال

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