-3

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>
megha
  • 170
  • 2
  • 10

2 Answers2

1

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)

Stuart Grant
  • 414
  • 3
  • 12
0

You have to include these three js

<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>

Please refer this link

Varada
  • 16,026
  • 13
  • 48
  • 69