[英]Why am I unable to get the location from this jsonp response?
我是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");
});
除我无法找到位置外,其他一切进展顺利。 但是, 在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");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.