js 通過騰訊地圖api簡單獲取地理位置信息


騰訊ip定位:https://lbs.qq.com/service/webService/webServiceGuide/webServiceIp

申請一個騰訊地圖key:https://lbs.qq.com/dev/console/key/manage

使用方法如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>test</title>
    <script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
    
</body>
<script>
    $.ajax({
        type:'get',
        url:'https://apis.map.qq.com/ws/location/v1/ip',
        data:{
            key:'NUMBZ-QW4RF-CLQJI-J5A77-XIRM3-26BWY', //騰訊key(我的測試key)
            output:'jsonp',
        },
        dataType: 'jsonp',
        success:function (res){
            console.log(res)
        }
    })
</script>
</html>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM