Google Maps JSON code “mark my location not working”
up vote
0
down vote
favorite
Can someone tell me what is wrong to this code?
I can't see the address that i specify on this code :
(function($)
$(document).ready(function ()
var map = new google.maps.Map($('#map_canvas_contactus')[0]);
var addresses = ["54 Scholars Ct, Northampton, Northamptonshire NN1 1ES, United Kingdom","JMC House Newlands Naas Rd 22 Co, Dublin 15, Dublin ,Ireland"];
var infowindow = new google.maps.InfoWindow();
var bounds = new google.maps.LatLngBounds();
var marker_icon = new google.maps.MarkerImage('images/marker_office.png',
new google.maps.Size(43, 63), // This marker is 129 pixels wide by 42 pixels tall.
new google.maps.Point(0,0),// The origin for this image is 0,0.
new google.maps.Point(21, 63)// The anchor for this image is the base of the flagpole at 18,42.
);
var marker_html;
for (var i = 0; i < addresses.length; i++)
marker_html = "Safty Gear ";
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses[i] + '&sensor=false', null, function (data)
var p = data.results[0].geometry.location
var latlng = new google.maps.LatLng(p.lat, p.lng);
var marker = new google.maps.Marker(
position: new google.maps.LatLng(p.lat, p.lng),
map: map,
icon: marker_icon, // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin
);
bounds.extend(marker.position);
google.maps.event.addListener(marker, 'click', (function (marker, x)
return function ()
infowindow.setContent(marker_html);
infowindow.open(map, marker);
)(marker, i));
);
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function ()
map.setZoom(4);
google.maps.event.removeListener(listener);
);
);
)(jQuery);
javascript json maps
add a comment |
up vote
0
down vote
favorite
Can someone tell me what is wrong to this code?
I can't see the address that i specify on this code :
(function($)
$(document).ready(function ()
var map = new google.maps.Map($('#map_canvas_contactus')[0]);
var addresses = ["54 Scholars Ct, Northampton, Northamptonshire NN1 1ES, United Kingdom","JMC House Newlands Naas Rd 22 Co, Dublin 15, Dublin ,Ireland"];
var infowindow = new google.maps.InfoWindow();
var bounds = new google.maps.LatLngBounds();
var marker_icon = new google.maps.MarkerImage('images/marker_office.png',
new google.maps.Size(43, 63), // This marker is 129 pixels wide by 42 pixels tall.
new google.maps.Point(0,0),// The origin for this image is 0,0.
new google.maps.Point(21, 63)// The anchor for this image is the base of the flagpole at 18,42.
);
var marker_html;
for (var i = 0; i < addresses.length; i++)
marker_html = "Safty Gear ";
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses[i] + '&sensor=false', null, function (data)
var p = data.results[0].geometry.location
var latlng = new google.maps.LatLng(p.lat, p.lng);
var marker = new google.maps.Marker(
position: new google.maps.LatLng(p.lat, p.lng),
map: map,
icon: marker_icon, // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin
);
bounds.extend(marker.position);
google.maps.event.addListener(marker, 'click', (function (marker, x)
return function ()
infowindow.setContent(marker_html);
infowindow.open(map, marker);
)(marker, i));
);
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function ()
map.setZoom(4);
google.maps.event.removeListener(listener);
);
);
)(jQuery);
javascript json maps
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Can someone tell me what is wrong to this code?
I can't see the address that i specify on this code :
(function($)
$(document).ready(function ()
var map = new google.maps.Map($('#map_canvas_contactus')[0]);
var addresses = ["54 Scholars Ct, Northampton, Northamptonshire NN1 1ES, United Kingdom","JMC House Newlands Naas Rd 22 Co, Dublin 15, Dublin ,Ireland"];
var infowindow = new google.maps.InfoWindow();
var bounds = new google.maps.LatLngBounds();
var marker_icon = new google.maps.MarkerImage('images/marker_office.png',
new google.maps.Size(43, 63), // This marker is 129 pixels wide by 42 pixels tall.
new google.maps.Point(0,0),// The origin for this image is 0,0.
new google.maps.Point(21, 63)// The anchor for this image is the base of the flagpole at 18,42.
);
var marker_html;
for (var i = 0; i < addresses.length; i++)
marker_html = "Safty Gear ";
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses[i] + '&sensor=false', null, function (data)
var p = data.results[0].geometry.location
var latlng = new google.maps.LatLng(p.lat, p.lng);
var marker = new google.maps.Marker(
position: new google.maps.LatLng(p.lat, p.lng),
map: map,
icon: marker_icon, // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin
);
bounds.extend(marker.position);
google.maps.event.addListener(marker, 'click', (function (marker, x)
return function ()
infowindow.setContent(marker_html);
infowindow.open(map, marker);
)(marker, i));
);
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function ()
map.setZoom(4);
google.maps.event.removeListener(listener);
);
);
)(jQuery);
javascript json maps
Can someone tell me what is wrong to this code?
I can't see the address that i specify on this code :
(function($)
$(document).ready(function ()
var map = new google.maps.Map($('#map_canvas_contactus')[0]);
var addresses = ["54 Scholars Ct, Northampton, Northamptonshire NN1 1ES, United Kingdom","JMC House Newlands Naas Rd 22 Co, Dublin 15, Dublin ,Ireland"];
var infowindow = new google.maps.InfoWindow();
var bounds = new google.maps.LatLngBounds();
var marker_icon = new google.maps.MarkerImage('images/marker_office.png',
new google.maps.Size(43, 63), // This marker is 129 pixels wide by 42 pixels tall.
new google.maps.Point(0,0),// The origin for this image is 0,0.
new google.maps.Point(21, 63)// The anchor for this image is the base of the flagpole at 18,42.
);
var marker_html;
for (var i = 0; i < addresses.length; i++)
marker_html = "Safty Gear ";
$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=' + addresses[i] + '&sensor=false', null, function (data)
var p = data.results[0].geometry.location
var latlng = new google.maps.LatLng(p.lat, p.lng);
var marker = new google.maps.Marker(
position: new google.maps.LatLng(p.lat, p.lng),
map: map,
icon: marker_icon, // This path is the custom pin to be shown. Remove this line and the proceeding comma to use default pin
);
bounds.extend(marker.position);
google.maps.event.addListener(marker, 'click', (function (marker, x)
return function ()
infowindow.setContent(marker_html);
infowindow.open(map, marker);
)(marker, i));
);
map.fitBounds(bounds);
var listener = google.maps.event.addListener(map, "idle", function ()
map.setZoom(4);
google.maps.event.removeListener(listener);
);
);
)(jQuery);
javascript json maps
javascript json maps
edited Nov 10 at 17:04
jww
51.8k37211477
51.8k37211477
asked Nov 10 at 17:02
user10633636
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
draft saved
draft discarded
draft saved
draft discarded
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53241297%2fgoogle-maps-json-code-mark-my-location-not-working%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown