Quite simple....
Just needed to add
map.fitBounds(markers.getBounds());
inside of the .success().
Full working code:
function plotMarkers(MarkerItems) {
if (MarkerItems) {
MarkerItems.success(function (data) {
var len = data.length;
for (var i = 0; i < len; i++) {
m = data[i];
var XX = parseFloat(m.X.replace(",", "."));
var YY = parseFloat(m.Y.replace(",", "."));
var marker = L.marker(new L.LatLng(XX, YY), { icon: blueFlagIcon }).bindPopup("test");
markers.addLayer(marker);
}
map.addLayer(markers);
map.fitBounds(markers.getBounds());
});// success
}}