I have a Google Map that is loading up to the correct lat and lon. I would like to place a marker at that lat and lon.
Here is my code
function initialize() { var mapCanvas = document.getElementById('map_canvas2'); var myLatLng = { lat: contactLatitude, lng: contactLongitude }; var mapOptions = { center: new google.maps.LatLng(contactLatitude, contactLongitude), zoom: 8, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(mapCanvas, mapOptions); addMarker(myLatLng, map); } function addMarker(location, map) { var marker = new google.maps.Marker({ position: location, title: 'Home Center' }); } google.maps.event.addDomListener(window, 'load', initialize); Everything displays just fine but the marker doesn't show up. What am I doing wrong?