获取用户的正确位置以显示在屏幕上
Get the correct location of a user to display on the screen
好的,这就是我使用的 javascript Link 。我遇到的问题是代码显示用户位置的地球而不是实际城市。如果我更改
的值
$(".currentLocation").html(city);
至
$(".currentLocation").html(data.name);
我得到的不是位置,而是一片空白。
可能是因为您在 freegeoip 请求中调用了 $get 而不是 $.get()。
同时更改最后一行以使用 getLocation()
$(function() {
getLocation();
});
好的,这就是我使用的 javascript Link 。我遇到的问题是代码显示用户位置的地球而不是实际城市。如果我更改
的值$(".currentLocation").html(city);
至
$(".currentLocation").html(data.name);
我得到的不是位置,而是一片空白。
可能是因为您在 freegeoip 请求中调用了 $get 而不是 $.get()。
同时更改最后一行以使用 getLocation()
$(function() {
getLocation();
});