user2314808
user2314808

Reputation: 11

google maps load error "google" undefined

ok, I have a problem on this when loading the maps, this part will shows "google" as undefined.

var polyline = [
    new Google.map.LatLng(3.032617, 101.376),
    new Google.map.LatLng(3.03255, 101.3759),
    new Google.map.LatLng(3.032467, 101.3758),
    new Google.map.LatLng(3.031867, 101.3753),
    new Google.map.LatLng(3.0318, 101.3753)
];

var polylineopts = {
  path: polyline,
  map: map,
  strokecolor: 'blue',
  strokeopacity: 1.6,
  strokeweight: 3,
  geodesic: true
};

var poly = new google.maps.Polyline(polylineopts);

Upvotes: 0

Views: 707

Answers (1)

geocodezip
geocodezip

Reputation: 161324

I expect the error is "Google" is undefined. Javascript is case sensitive.

Should be:

var polyline = [
    new google.maps.LatLng(3.032617, 101.376),
    new google.maps.LatLng(3.03255, 101.3759),
    new google.maps.LatLng(3.032467, 101.3758),
    new google.maps.LatLng(3.031867, 101.3753),
    new google.maps.LatLng(3.0318, 101.3753)
];

var polylineopts = {
  path: polyline,
  map: map,
  strokecolor: 'blue',
  strokeopacity: 1.6,
  strokeweight: 3,
  geodesic: true
};

var poly = new google.maps.Polyline(polylineopts);

working example

Upvotes: 2

Related Questions