freegeoip doesn't work anymore

A few months ago I created a code that detect a visitor country and display the legal drinking age. For country in EU is 18 and for other countries is 21.

I'm using the freegeoip.

The code was working great, but now I noticed that doesn't work anymore.

    $.get("", function (response) {
    $("#ip").html("IP: " + response.ip);
    if(response.country_code=='AL','AD','AT','BY','BE','BA','BG','HR','CY','CZ','DK','EE','FO','FI','FR','DE','GI','GR','HU','IS','IE','IT','LV','LI','LT','LU','MK','MT','MD','MC','NL','NO','PL','PT','RO','RU','SM','RS','SK','SI','ES','SE','CH','UA','VA','RS','IM','RS','ME') {
    } else {
}, "jsonp");

Here I dispay the age:

<span>ARE YOU</span> OVER <span class="age"></span>?

I assume that the problem is in freegeoip but I can't fix it.

Answers 1

  • I just found an answer for the problem. I noticed that the website doesn't work so I changed the service.

    I replaced the with

    and added <script language="Javascript" src=",GeobytesCode,GeobytesInternet,GeobytesFqcn"></script>

    Now the code works again.

Related Articles