如何使用IP地理位置记录位置?

问题描述 投票:0回答:1

我有一个使用Geolocation DB脚本的脚本,该脚本根据用户的IP跟踪用户的位置。我对此并不陌生,正在寻找一种方法来记录所跟踪的位置,以便我可以看到它们。

这是脚本/ HTML。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>

    <div>State: <span id="state"></span></div>
    <div>City: <span id="city"></span></div>
    <div>Latitude: <span id="latitude"></span></div>
    <div>Longitude: <span id="longitude"></span></div>
    <div>IP: <span id="ip"></span></div>
    <script>
      $.getJSON('https://geolocation-db.com/json/')
         .done (function(location) {
            $('#country').html(location.country_name);
            $('#state').html(location.state);
            $('#city').html(location.city);
            $('#latitude').html(location.latitude);
            $('#longitude').html(location.longitude);
            $('#ip').html(location.IPv4);
         });
    </script>

因此它将在其屏幕上)显示用户的位置for。不过,我需要一种查看方法。我将如何处理?谢谢!

我有一个使用Geolocation DB脚本的脚本,该脚本根据用户的IP跟踪用户的位置。我对此并不陌生,正在寻找一种方法来记录所跟踪的位置,以便可以看到它们。 ...

javascript html css geolocation ip-address
1个回答
0
投票

检查一下。我已经纠正了。

© www.soinside.com 2019 - 2024. All rights reserved.