title: How to set google maps marker with database value
body: <p>I am new to google maps api. I create a maps with hardcore values as markers. But I want to create my markers with the values came from database. Here is my code</p>
  
  <pre><code> function initialize() {
  
          var map = new google.maps.Map(document.getElementById("map_canvas"), {
              mapTypeId: google.maps.MapTypeId.ROADMAP,
              streetViewControl: false
          });
  
          var markers = [             // Here I set the hard core values for my markers.
              { lat: 22.64201389, lng: 88.43034722, name: "Airport" },
              { lat: 22.60944444, lng: 88.42694444, name: "Baguihati" },
              { lat: 22.53604167, lng: 88.36083333, name: "Ballygunge Phari" },
              { lat: 22.49895833, lng: 88.31902778, name: "Behala" },
              { lat: 22.65743056, lng: 88.36409722, name: "Dakshineshwar" },
              { lat: 22.62013889, lng: 88.39215278 , name: "Dum-Dum Station." },
              { lat: 22.52111111, lng: 88.36479167, name: "Gariahat" },
              { lat: 22.58763889, lng: 88.34027778, name: "Howrah" },
              { lat: 22.59131944, lng: 88.43291667, name: "Karunamayee East" },
              { lat: 22.52131944, lng: 88.38201389, name: "Kasba Bosepukur" },
              { lat: 22.60256944 , lng: 88.40166667 , name: "Lake Town" },
              { lat: 22.68993056, lng: 88.47569444, name: "Madhyam Gram_East" },
              { lat: 22.50875 , lng: 88.33284722 , name: " New Alipur" },
              { lat: 22.54409722 , lng: 88.36743056, name: "Park circus" },
          ];
  
          for (index in markers) addMarker(markers[index]);
          function addMarker(data) {
              new google.maps.Marker({
                  position: new google.maps.LatLng(data.lat, data.lng),
                  map: map,
                  title: data.name
              });
  
          }
  
          var bounds = new google.maps.LatLngBounds();
          for (index in markers) {
              var data = markers[index];
              bounds.extend(new google.maps.LatLng(data.lat, data.lng));
          }
          map.fitBounds(bounds);
  </code></pre>
  
  <p>Please help me to set the database values in the maker.. The values will be comes from servlet.</p>