为什么我无法从json响应中获得位置?
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");
相关文章:
- 在网站中处理 SQL 响应的位置
- 鼠标在HTML 5响应画布中的位置
- 位置问题:固定和响应/自适应布局
- 如何从 jQuery Get 获取响应标头位置
- 在单击事件时更新主干模型,并在更改位置之前等待响应
- 应用 API 响应转换的最佳位置
- Ajax响应更改位置
- 响应性”;类似砖石的“;不使用砖石的柱(尽量避免位置:绝对;)
- 如何获取ajax请求响应中存在的图像的位置,并使用位置绘制线
- jQuery工具提示卡在页面左侧,对放置/位置没有响应
- 如何将元素放置在不同的位置(响应)
- 使用javascript检索响应的头(位置)值
- 重新加载方法:响应文本与窗口.位置.href(1 次旅行与 2 次)
- 固定位置的响应图像周围的内容
- 位置Div在背景图像的顶部(覆盖/响应)
- 处理跨域REST响应的301和位置标头
- 我想在jQuery中如何从响应头获得位置属性
- 位置图标跟随响应的背景图像
- 获取Div位置与响应式布局
- 我怎么能有一个响应高度与绝对位置子元素