Fetch Country, City, region and Ip details Using JavaScript in asp.net

 Fetch Country, City, region and Ip details Using JavaScript in asp.net




<head runat="server">
    <title></title>
    <script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script>
<script type="text/javascript">
    var ip, country, city, region
    function GetInfo(data) {
        ip = data.host; country = data.countryName; city = data.city;
        region = data.region;
    }
    $(function () {
        BindUserInfo();
    })
    function BindUserInfo() {
        document.getElementById('lbl_Ip').innerHTML = ip;
        document.getElementById('LBL_COUNTRY').innerHTML = country;
        document.getElementById('lbl_city').innerHTML = city;
        document.getElementById('lbl_region').innerHTML = region;
      
    }
</script>
<script type="text/javascript" src="http://smart-ip.net/geoip-json?callback=GetInfo"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <strong style="color:red">Country :</strong>  <asp:Label ID="LBL_COUNTRY" runat="server"></asp:Label><br />
        <strong style="color:red">City  :</strong>  <asp:Label ID="lbl_city" runat="server"></asp:Label><br />
       <strong style="color:red"> Region  :</strong>  <asp:Label ID="lbl_region" runat="server"></asp:Label><br />
       <strong style="color:red"> Ip  :</strong>  <asp:Label ID="lbl_Ip" runat="server"></asp:Label><br />
    </div>
    </form>
</body>


It will look like :-




Comments

Popular posts from this blog

Create and save QR code in asp.net with C#

Change text of RadGrid Header Dynamically

Telerik Radwindow Open on Button Click