0
<script type="text/javascript" src="//js.maxmind.com/js/apis/geoip2/v2.1/geoip2.js"></script>
<script type="text/javascript">
var onSuccess = function(location){
var x = JSON.stringify(location, undefined, 3);
document.write(x);
return x;
};
var onError = function(error){
alert(
"Error:\n\n"
+ JSON.stringify(error, undefined, 3)
);
};
geoip2.city(onSuccess, onError);
</script>
Didn’t work :/
– Julio Ramos
You are using a specific API, which is this
– Thuan Saraiva
http://dev.maxmind.com/geoip/legacy/javascript/
– Thuan Saraiva
In the api documentation it recommends using the function "geoip_latitude()" and "geoip_longitude()" both returning a decimal value
– Thuan Saraiva
Ahh.. I now understand.. the function will return a JSON Object... Then you should use the variable of the callback in case x, it looks like this: x.latitude and x.longitude;
– Thuan Saraiva