Hi I found how to get client ip by answer here: Can I perform a DNS lookup (hostname to IP address) using client-side Javascript?
But I don't understand how to use it.
This is what I have:
var user;
if ($('#user-id').length) {
user = $('#user-id').text();
} else {
http://jsonip.appspot.com/?callback=getip
function getip(json){
user = json.ip;
}
}
I don't understand how to include the url and how to use the getip function.
I need to set the user to the ip address in the else.
Thanks!