Google maps API - add marker by address javascript
I have database of places with addresses and I want to add markers on google maps. It shows only the default marker, seems like the geocoder.geocode() does nothing. For an example I'm trying to add a marker on " New York City", with no success. <script> var geocoder; var map; var address = "new york city"; geocoder = new google.maps.Geocoder(); function initMap() { var uluru = { lat: -25.363, lng: 131.044 }; var map = new google.maps.Map(document.getElementById('map'), { zoom: 4, center: uluru }); var marker = new google.maps.Marker({ position: uluru, map: map }); codeAddress(address); }