我是jQuery
JSFiddle的新手,基于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");
});
一切顺利,除了我无法找到位置。但是,在JSFiddle中,可以恢复该位置。
如何获取位置坐标?:)
嗨,您错过了$(“#location”)#在JSFiddle中已更新
$.get("http://ipinfo.io", function (response) {
$("#ip").html("IP: " + response.ip);
$("#address").html("Location: " + response.city + ", " + response.region);
$("#location").html("Location Lat Long:"+response.loc);
$("#details").html(JSON.stringify(response, null, 4));
}, "jsonp");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句