js es定位
来源:互联网 发布:linux ioctlsocket 编辑:程序博客网 时间:2024/06/05 15:04
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/reqwest/2.0.5/reqwest.min.js"></script>
</head>
<body>
<p id="demo"></p>
<script>
$(function(){
var x=document.getElementById("demo");
function getLocation(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition);
}else{
x.innerHTML="Geolocation is not supported by this browser.";
}
}
function showPosition(position){
//x.innerHTML="Latitude: " + position.coords.latitude + "<br />Longitude: " + position.coords.longitude;
reqwest({
url: 'http://47.95.225.201:9200/location/location/',
method: 'post'
, data: JSON.stringify({ Latitude: position.coords.latitude, Longitude: position.coords.longitude })
, contentType: 'application/json'
, crossOrigin: true
, success: function (resp) {
}
})
}
getLocation();
});
</script>
</body>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
<script src="https://cdn.bootcss.com/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/reqwest/2.0.5/reqwest.min.js"></script>
</head>
<body>
<p id="demo"></p>
<script>
$(function(){
var x=document.getElementById("demo");
function getLocation(){
if (navigator.geolocation){
navigator.geolocation.getCurrentPosition(showPosition);
}else{
x.innerHTML="Geolocation is not supported by this browser.";
}
}
function showPosition(position){
//x.innerHTML="Latitude: " + position.coords.latitude + "<br />Longitude: " + position.coords.longitude;
reqwest({
url: 'http://47.95.225.201:9200/location/location/',
method: 'post'
, data: JSON.stringify({ Latitude: position.coords.latitude, Longitude: position.coords.longitude })
, contentType: 'application/json'
, crossOrigin: true
, success: function (resp) {
}
})
}
getLocation();
});
</script>
</body>
</html>
es记得开http.cors.enabled: true
阅读全文
0 0
- js es定位
- js--定位
- JS焦点定位 ,JS描点定位
- JS错误定位方法
- JS错误定位
- js定位菜单
- js锚点定位
- js锚点定位
- js定位问题
- JS焦点定位
- js 实现div定位
- js浮动定位
- js页面定位
- js中的各种定位
- js定位navigator.geolocation
- js定位DOM元素
- JS的问题定位
- 百度地图定位js
- 页面滚动选中左侧导航栏之HelloWorld
- Mysql log文件之 relay log、master log info、relay log info
- 【Linux】使用yum命令在线安装JDK
- 集成融云的 踩到的坑。。。
- 数据结构第三周选择排序与快速排序差别
- js es定位
- mysql 查找结果中自动加序号列
- offer
- 原创/收集一些好的idea吧->然后出一些题【想法很好】
- 8、HALCON数据类型,tuple、image、region、XLD
- Android ListView通用单个多个布局
- json相关操作
- C/C++中extern关键字详解
- C# WinForm控件之Dock控件调整先后顺序