Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I work with google map and this below code is working good for me.

HTML
<html>
<head>
  <script>
      var geocoder;
      var map;
      function codeAddress() {
          geocoder = new google.maps.Geocoder();
          var lat = '';
          var lng = '';
          var address = "swaminaray nagar nizampura, VADODARA - 390020";
          geocoder.geocode({ 'address': address }, function (results, status) {
              if (status == google.maps.GeocoderStatus.OK) {
                  lat = results[0].geometry.location.lat(); //getting the lat
                  lng = results[0].geometry.location.lng(); //getting the lng
                  map.setCenter(results[0].geometry.location);
                  var marker = new google.maps.Marker({
                      map: map,
                      position: results[0].geometry.location
                  });
              } else {
                  alert("Geocode was not successful for the following reason: " + status);
              }
          });
     
          

          var latlng = new google.maps.LatLng(lat, lng);
          var myOptions = {
              zoom: 8,
              center: latlng,
              mapTypeId: google.maps.MapTypeId.ROADMAP
          }
          map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
      }


      window.onload = function () {
          codeAddress();
      }
</script>
</head>
<body>
    <script src="http://maps.google.com/maps/api/js?libraries=places®ion=uk&language=en&sensor=true"></script>
  <div id="map_canvas" style="height: 350px; width: 900px; margin: 0.6em;">
    </div>
</body>
</html>

But i want one popup on marker so any one can get address just by simple clicking on this marker. (eg google map display this type of marker popup on click.)
Posted

1 solution

hi check this given link
click here for your abslute answer
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900