Рет қаралды 1,223
Blog Link: thapliyalravi80.blogspot.com/...
#Geolocation #javascript #API #google console #tutorials #geolocationAPI
*****JS Code ****
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition, showError);
} else {
alert("Geolocation is not supported by this browser.");
}
}
function showPosition(position) {
apex.item("PAGE_ITEM_LAT").setValue(position.coords.latitude)
apex.item("PAGE_ITEM_LONG").setValue(position.coords.longitude)
function geocode_api(){
var latitude = position.coords.latitude
var longitude = position.coords.longitude
var key = "API_KEY"
$.post('maps.googleapis.com/maps/api/..., //get this line code from comment section and replace it with this line as in description it is taking it as link.
function(data, status){
var address = JSON.parse(JSON.stringify(data.results[0].formatted_address))
apex.item("PAGE_ITEM_LOCATION").setValue(address)
// alert("Data: " + data + "
Status: " + status);
});
};
geocode_api();
}
function showError(error) {
switch(error.code) {
case error.PERMISSION_DENIED:
alert("User denied the request for Geolocation.")
break;
case error.POSITION_UNAVAILABLE:
alert("Location information is unavailable.geolocation app tutorial, geolocation, javascript, location")
break;
case error.TIMEOUT:
alert("The request to get user location timed out.")
break;
case error.UNKNOWN_ERROR:
alert( "An unknown error occurred.")
break;
}
}
razorpay payment gateway integration || payment gateway for website
• razorpay payment gatew...
Shopify API Tutorial | Shopify tutorial for beginners || Shopify API get all products || postman API
• shopify API Tutorial |...
PayPal smart payment button for website | PayPal account Kaise banaye | PayPal business account
• How to create paypal a...
oracle apex tutorial for beginners in hindi || step-by-step from starting || oracle apex ✔️
• oracle apex tutorial f...