I'm trying to pull the latitude/longitude from an API call to Google Maps. The code I am using is the following:
var text gMaps = "https://maps.googleapis.com/maps/api/geocode/xml?address=" & URLEncode(SearchAndReplace([Related Staff - Address]," ","+")) & "&key=xxxxxxxxxxxxxxxxxxxx";
var text lat = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord" & "&rid=" & [Record ID#] & "&apptoken=xxxxxxxxxxxxx" & "&_fid_113=";
"javascript: {" &
"$.get('" & $gMaps & "',function(data,success) {" &
"console.log(data);" &
"var geo = data.getElementsByTagName('geometry')[0].getAttribute('lat');" &
"console.log(geo);" &
"$.get('" & $lat & "'+geo);" &
"window.location.reload();" &
"});" &
"}"
This is for a button in Quickbase to put the info into 2 fields. The example above is only dealing with the latitude for now. This code is giving me a null result, I'm familiar with javascript, but still need a lot of learning.
Here's the xml response that I'm pulling from.
Thanks for any help provided.
Dana