title: Trouble with OpenLayers.Layer.Markers - only last added marker is displayed on map
body: <pre><code>function init_map() {
      var map, layer;
      map = new OpenLayers.Map('map');
      layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
          "http://vmap0.tiles.osgeo.org/wms/vmap0", {layers: 'basic'} );
      map.addLayer(layer);
      map.setCenter(new OpenLayers.LonLat(43.5, 40), 10);
      var size = new OpenLayers.Size(21,25);
      var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
      var icon = new OpenLayers.Icon('http://www.openlayers.org/dev/img/marker.png',size,offset);
      var markers = new OpenLayers.Layer.Markers("Objects");
      map.addControl(new OpenLayers.Control.LayerSwitcher());
      map.addLayer(markers);
      $.ajax({
          type: "GET",
          url: "/rest/displaymap/getMarkers/",
          dataType: "json",
          error: function() {
              console.log('failed to retrieve data');
          },
          success: function(d) {
              console.log(d);
              var i;
              for(i=0; i&lt;d.length; i++) {
                  var mrk = new OpenLayers.Marker(new OpenLayers.LonLat(d[i]['objectLon'],d[i]['objectLat']), icon);
                  markers.addMarker(mrk);
              }    
          }
      });
  }
  </code></pre>
  
  <p>^ my Init() function. I have a simple layer with markers and tiles layer. Returned json is correct. But only one marker is displayed instead of all. Dunno where is the problem. Help please!</p>