i'm trying the following code to retrieve the client ip, and it works fine
<script type="text/javascript">
function getip(json) {
var ip = json.ip; // alerts the client ip address
alert(ip);
}
</script>
<script type="text/javascript" src="http://jsonip.appspot.com/?callback=getip"></script>
but when i try it with $.ajax
it does nothing...
$.ajax({
type: "GET",
url: 'http://jsonip.appspot.com/?callback=getip',
dataType: "jsonp",
success: function getip(json) {
alert("sucess");
var ip = json.ip;
alert(ip);
}
});
});
plz help