查找纬度&给定IP地址的经度使用IPMapper [英] Find Latitude & Longitude of a given IP Address using IPMapper

查看:104
本文介绍了查找纬度&给定IP地址的经度使用IPMapper的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用IPMapper获取给定IP地址的纬度和经度时,出现以下错误RefrenceError:IPMApper not defined。

 < head> 
< meta http-equiv =Content-Typecontent =text / html; charset = utf-8/>
< title> Google地图上的IP地址地理编码< / title>
< script type =text / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js>< / script>
< script type =text / javascriptsrc =http://maps.google.com/maps/api/js?sensor=false>< / script>
< script type =text / javascriptsrc =ipmapper.js>< / script>
$(function(){
try {
IPMapper.initializeMap(map);
IPMapper.addIPMarker(111.111.111.111);
}
catch(e){
alert(e);
}
});
< / head>
< body>
< input id =ipname =iptype =text/>
< button onclick =IPMapper.addIPMarker($('#ip').val());> Geocode< / button>
< div id =mapstyle =height:500px; border:red 4px;>< / div>
< / body>
< / html>


解决方案

您是否有'ipmapper.js'文件你的解决方案/项目? src引用是否与服务器上的位置匹配?



尝试将IPMapperjs引用在项目中使用绝对路径而不是相对路径

(文件位于网站的根目录)

I'm getting the following error "RefrenceError: IPMApper not defined", when I try to get the Latitude and Longitude for a given IP address using IPMapper. I'm specifying code for your clarity.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IP Address geocoding on Google Maps</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="ipmapper.js"></script>
$(function(){
    try{
        IPMapper.initializeMap("map");
        IPMapper.addIPMarker("111.111.111.111");
        }
    catch(e){
        alert(e);
    }
});
</head>
<body>
    <input id="ip" name="ip" type="text" />
    <button onclick="IPMapper.addIPMarker($('#ip').val());">Geocode</button>
    <div id="map" style="height: 500px;border: red 4px;"></div>
</body>
</html>

解决方案

Have you got the file 'ipmapper.js' in your solution / project? Does the src reference match the location on your server?

Try putting the IPMapperjs reference to use absolute path in your project rather than relative path

(file would be in the root of the website)

这篇关于查找纬度&amp;给定IP地址的经度使用IPMapper的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆