Get city and country and Client IP using JavaScript

Get city and country and Client IP using JavaScript
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>

 

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *