main_map.on('draw:created', function (e) {var type = e.layerType,layer = e.layer;if (type === 'marker') {// Do marker specific actions}// Do whatever else you need to. (save to db, add to map etc)main_map.addLayer(layer);layer.bindPopup("test").openPopup();});
layer._popup.setLatLng(layer.getBounds().getCenter());