Example:
<script type="application/javascript">
function getip(json){
alert(json.ip);
}
</script>
<script type="application/javascript" src="http://jsonip.appspot.com/?callback=getip"></script>
Or
<script language="JavaScript">
VIH_BackColor = "palegreen";
VIH_ForeColor = "navy";
VIH_FontPix = "16";
VIH_DisplayFormat = "You are visiting from:<br>IP Address: %%IP%%<br>Host: %%HOST%%";
VIH_DisplayOnPage = "yes";
</br></br></script>
<script language="JavaScript" src="http://scripts.hashemian.com/js/visitorIPHOST.js.php"></script>
Please vote and Accept Answer if it Helped.