I'm not a programmer, but can usually follow other examples to accomplish what I want. I'm having trouble understanding how to use data being returned from Google Distance Matrix API.
Once someone puts information in the To_Address, I want to return the miles in the Distance input.
I've set up getURL to Google Distance Matrix API and have a successful response back. I see that the data is stored in map.get("responseText"). Here is the complete response:
{
"destination_addresses" : [ "Plainfield, IN 46168, USA" ],
"origin_addresses" : [ "Indianapolis, IN 46222, USA" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "18.5 mi",
"value" : 29806
},
"duration" : {
"text" : "27 mins",
"value" : 1628
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
I have no idea how to take the information stored in map.get("responseText") and get down to just 18.5 mi being returned to my Distance input.
Can a kind soul, please walk me through the process?
Thanks!