Completed function to request distances to Google Maps API