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









share|improve this question



























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









    share|improve this question

























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









      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 10 at 17:04









      jww

      51.8k37211477




      51.8k37211477










      asked Nov 10 at 17:02







      user10633636


































          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













           

          draft saved


          draft discarded


















          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





























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















           

          draft saved


          draft discarded















































           


          draft saved


          draft discarded














          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





















































          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







          這個網誌中的熱門文章

          What does pagestruct do in Eviews?

          Dutch intervention in Lombok and Karangasem

          Channel Islands