Get city and country and Client IP using JavaScript

0
2304
In this post, we are going to learn to get city and country and client using JavaScript.
Sample JavaScript to get city and country and Client IP using JavaScript

 

<div id="IP">Loading...................</div>
<div id="Country">Loading...................</div>
<script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript">
 $.get('https://ipinfo.io',function(response){
  $("#IP").html('IP:<b>'+response.ip+'<b>');
 $("#Country").html('Country:<b>'+response.country+'<b>');
 },'json');
</script>

 

Comments are closed.