navigator.geolocation.getCurrentPosition(
function(position) {
$.ajax({
url: '/api/setPosition',
data: {lat: position.coords.latitude, lng: position.coords.longitude},
method: 'post',
success: function (response) {
console.log('success');
},
error: function (error) {
console.error(error);
}
});
}
);