0

i try many different examples to use with jquery-ui-map jquery plugin, but haven't lucky.

This is the simple code

<!DOCTYPE HTML>
<html>

<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript" src="js/jquery.ui.map.js"></script>
    <script type="text/javascript" src="js/jquery.ui.map.services.js"></script>
    <script type="text/javascript" charset="utf-8" src="jquery-1.7.1.min.js"></script>
    <script>
        function init() {
          $('#map_canvas').gmap({ 'center': '42.345573,-71.098326' });
        };
    </script>
</head>

<body onload="init();">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>

</html>

The script it's launched fine and in firebug console every time shows me this:

URL: GET "https://maps.googleapis.com/maps/gen_204?ev=api_ads&cad=src:apiv3,ads:0" STATUS: 204 No Content

My first impression was i don't use the API KEY, but in the Google Documentation said "Not mandatory to use the KEY".

Any idea ?

Thanks in advance.

jgiunta
  • 721
  • 2
  • 8
  • 28

1 Answers1

0

Here is a working example. You should only change paths to jquery and jquery-ui-map:

<!DOCTYPE HTML>
<html>
    <head>
        <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
        <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript" src="js/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="js/jquery/jquery.ui.map.full.min.js"></script>
        <script>
            function init() {
              $('#map_canvas').gmap({ 'center': '42.345573,-71.098326' });
            };
        </script>
    </head>

    <body onload="init();">
        <div id="map_canvas" style="width:100%;height:350px;"></div>
    </body>    
</html>

Your mistakes seem to be the following:

  1. You must include jQuery before ui-map-plugin
  2. map_canvas's style height should be in px.
  3. You should get the api through http instead of https
Littm
  • 4,923
  • 4
  • 30
  • 38
serg
  • 36
  • 2