I'm having some trouble adding more than 1 marker to my map. If I want to display one marker, it works fine. Here is what I have:

<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
 function initialize() {
        var map_canvas = document.getElementById('map_canvas');
        var map_options = {
          center: new google.maps.LatLng(42.3581, -71.0636),
          zoom: 13,
          mapTypeId: google.maps.MapTypeId.ROADMAP
        }
        var map = new google.maps.Map(map_canvas, map_options)

        //this section works perfectly and displays the marker
        var image = 'http://media.tumblr.com/tumblr_m3w1gbnPK21r017k2.png'; //cappy's pizza
        var myLatLng = new google.maps.LatLng(42.343744, -71.089640);
        var placeMarker = new google.maps.Marker({
        position: myLatLng,
        map: map,
        icon: image

       //but when I add this, the map doesn't show up at all
        var image2 = 'http://icons.iconarchive.com/icons/mad-science/food-on-a-stick/32/kabob-icon.png'; //ali baba
        var myLatLng2 = new google.maps.LatLng(42.343613, -71.064816);
        var placeMarker2 = new google.maps.Marker({
        position: myLatLng2,
        map: map,
        icon: image2


  });
      }
      google.maps.event.addDomListener(window, 'load', initialize);



</script>

You are not closing off your google.maps.Marker code block for the first marker:

var placeMarker = new google.maps.Marker
({
        position: myLatLng,
        map: map,
        icon: image
});
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.