i got a one code which is close but i am not sure because i am first time working with Leaflet js.
my intention is: suppose Leaflet js is showing map or non geographical
Depends on what you're using to draw polygons/shapes. If you're using leaflet.draw, you would do something like:
map.on('draw:created', function(e) {
var points = JSON.stringify(e.layer.toGeoJSON());
});
And then saving points to your database.
Read the leaflet.draw documentation, it's pretty complete and straightforward.