This endpoint does not support callbacks (JSONP).
You have to do it in a Google way:
var distanceService = new google.maps.DistanceMatrixService(); distanceService.getDistanceMatrix({ origins: ['Istanbul, Turkey'], destinations: ['Ankara, Turkey'], travelMode: google.maps.TravelMode.DRIVING, unitSystem: google.maps.UnitSystem.METRIC, durationInTraffic: true, avoidHighways: false, avoidTolls: false }, function (response, status) { if (status !== google.maps.DistanceMatrixStatus.OK) { console.log('Error:', status); } else { console.log(response); } });
See here .
source share