CopyPastor

Detecting plagiarism made easy.

Score: 0.8259851336479187; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2018-05-24
by PPL

Original Post

Original - Posted on 2016-07-03
by James



            
Present in both answers; Present only in the new answer; Present only in the old answer;

use the distance matrix service directly through JavaScript like below
function getDistance() { //Find the distance var distanceService = new google.maps.DistanceMatrixService(); distanceService.getDistanceMatrix({ origins: [$("#autocompleteDeparture").val()], destinations: [$("#autocompleteArrival").val()], travelMode: google.maps.TravelMode.WALKING, 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); $("#distance").text(response.rows[0].elements[0].distance.text).show(); $("#duration").text(response.rows[0].elements[0].duration.text).show(); } }); }
After some more digging I found that the API does not support JSONP and that I could use the distance matrix service directly through JavaScript like so:
function getDistance() { //Find the distance var distanceService = new google.maps.DistanceMatrixService(); distanceService.getDistanceMatrix({ origins: [$("#autocompleteDeparture").val()], destinations: [$("#autocompleteArrival").val()], travelMode: google.maps.TravelMode.WALKING, 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); $("#distance").text(response.rows[0].elements[0].distance.text).show(); $("#duration").text(response.rows[0].elements[0].duration.text).show(); } }); }

        
Present in both answers; Present only in the new answer; Present only in the old answer;