SOURCE

console 命令行工具 X clear

                    
>
console
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>腾讯定位-jquery</title>
    <meta content="width=device-width,height=device-height,initial-scale=1.0,maximum-scale=1.0,user-scalable=no" name="viewport">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script><!-- 引用谷歌jQuery -->
    <script src="https://3gimg.qq.com/lightmap/components/geolocation/geolocation.min.js"></script><!-- 引用腾讯前端定位插件,建议下载到本地 -->
</head>
<body></body>
<script type="text/javascript">
    //实例化定位插件    定位获取地理位置信息,本插件只有在服务器上才能运行,不像IP定位,非服务器也能运行
    var geolocation = new qq.maps.Geolocation("DTTBZ-DZGRJ-XG3FL-F5I7V-I22UQ-ZIFLZ","得到位置啊");//参数为:开发秘钥、开发秘钥名称
    geolocation.getLocation(function(result){//定位成功
        console.log(result);
        document.write(JSON.stringify(result));
    },function(error){//定位失败
        console.log(error);
        document.write(JSON.stringify(error));
    });
</script>
</html>