I am working on to integrate Google Distance Matrix API to get the Distance a time between two locations. I am doing the following steps:
-
Using WiX address Input, I am getting the TO and FROM address from webpage
-
Storing the value into session storage for further use.
-
When I am storing the value session storage, it is a string. But while reteriving I am getting an object in return. Below is my code snippet:
-
Code Snippet while storing the value:
session.setItem("pickupaddrvalue", $w("#pickupaddr").value);
console.log($w("#pickupaddr").value);
- Console Output
Pick Up address = [object Object]{formatted: “Auckland, New Zealand”, location: {…}, subdivision: “Auckland”, city: “Auckland”, country: “NZ”}
-
city: “Auckland”
-
country: “NZ”
-
formatted: “Auckland, New Zealand”
-
location: {latitude: -36.8484597, longitude: 174.7633315}
-
subdivision: “Auckland”
-
proto: Object
- Getting the value from storage
let pickupaddrvalue = session.getItem("pickupaddrvalue");
console.log("Pick Up address = " + pickupaddrvalue)
- while performing the get I am getting an object rather than a text/string:
Pick Up address = [object Object]
Please help, If I am doing anything wrong here to receive a string.