Why does this javascript keep saying undefined?

almahuman

New Member
I'm using maxmind's geoip script in order to call out visitors individual city and state name when they arrive on my website. This is what I have done. I have this in my header:\[code\]<script language="JavaScript" src="http://j.maxmind.com/app/geoip.js"></script>\[/code\]Then, right under my \[code\]<body>\[/code\] tag, I have the following:\[code\]<script language="JavaScript">var country=geoip_country();var region=geoip_region();var city=geoip_city();if(country=="") country="US";if(region=="") region="New York";if(city=="") city="New York";</script>\[/code\]Then, in order to show the visitor's city for example, I put this:\[code\]<script language="JavaScript">document.write(city);</script>\[/code\]However, when I put the directly above on my website, it says undefined wherever the city is supposed to show up. It does this with other javascript I have as well and I'm wondering what I am doing wrong......Thank you for any insights. :)
 
Back
Top