标签:
<!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> <script src="js/jquery-1.11.2.min.js"></script> <script src="js/appcan.js"></script> <script src="js/appcan.control.js"></script> <script src="js/appcan.slider.js"></script> </head> <body> <div id="adre"></div> </body> </html> <script> $(function () { GetPostion() }); var longtitude = 0; var latitude = 0; function GetPostion() { //通过百度获取经纬度 var address = "具体的地理位置 "; var url = "http://api.map.baidu.com/geocoder/v2/?address=徐州&output=json&ak=FG7wxr1VUj0k2NwoO3yXzymd&callback=?"; $.getJSON(url, function (data) { longtitude = data.result.location.lng; latitude = data.result.location.lat; $(‘#adre‘).html(‘lon:‘+longtitude+‘;lat:‘+latitude) }); } </script>
标签:
原文地址:http://www.cnblogs.com/Celebrator/p/4686471.html