【发布时间】:2014-04-16 06:05:40
【问题描述】:
我是jQuery 的新手,基于 JSFiddle,我编写了一个脚本来定位自己。这是我的脚本:
$(document).ready(function(){
$.get("http://ipinfo.io", function (response) {
$("#ip").html("" + response.ip);
$("#hostname").html("" + response.hostname);
$("#city").html("" + response.city);
$("#region").html("" + response.region);
$("#country").html("" + response.country);
$("location").html("" + response.loc);
$("#organisation").html("" + response.org);
},"jsonp");
});
一切顺利,只是我无法获得位置。 In the JSFiddle,不过可以找回位置。
如何检索位置坐标? :)
【问题讨论】:
-
您在
$("location").html()上缺少# -
@fiction 现在我要拍自己x(
-
这种事经常发生在我身上,别担心 :)
标签: javascript jquery html geolocation jsonp