navigator.geolocation.getCurrentPosition() is used to get the location. It requires HTTPS. The values can be sent to the server with a form.

Press the button to get your location.