I am working on jquery,Right now i am getting user location after click on “button” but if user select “block” option then page is redirecting but but but “block location icon” not removing until i refresh page manually, in other words i want whenever i click/select “block” option then page should redirect and “location icon should remove from browser as well”,Here is my current code
$(".in").click(function () {
const options = {
enableHighAccuracy: true,
timeout: 5000,
maximumAge: 0
};
function success(pos) {
const crd = pos.coords;
var lats = crd.latitude;
var longs = crd.longitude;
$.ajax({
type: "POST",
url: "insert.php",
data: {
lats :lats,
longs :longs,
},
success: function (data) {
//further code
}
});
}
function error(err) {
var pathname = window.location.href;
alert('Please refresh page and select allow to continue for location');
window.location = pathname;
}
navigator.geolocation.getCurrentPosition(success, error, options);
});