I have a WMS layer in my leaflet map:
var wmsLayer = L.tileLayer.wms('http://localhost:8080/geoserver/volonteri/wms?', {
layers: "trgovine",
transparent: true,
format: 'image/png'
}).addTo(map);
In backend, there is a simple PHP script that stores new points into PostGIS table which is served via geoserver as WMS.
I use an AJAX request to send data to backend PHP script. I need to refresh the layer after successful insert to draw the new point on map, but cannot find any method for refreshing. The code looks like this:
$.ajax({
type: 'POST',
url: 'http://localhost:8000/api/trgovina',
data: {
'name': name,
'shop': shop,
'geom': geometry
},
success: function(){
/* Redraw/refresh/reload should go here */
}
});
How can I solve this? I remember the older versions of openlayers had something simple like .redraw() method, but I'm pretty new to leaflet.