Hi Deon,
It seems GS change my code above.
Here is a correct to replace:
precode
Code: Select all
if (XHRResponse.status == 200) {
// Get coordinates from the response
var lat = JSON.parse(XHRResponse.body).results[0].geometry.location.lat;
var lng = JSON.parse(XHRResponse.body).results[0].geometry.location.lng;
var distance = getDistance(lat, latitude, lng, longitude);
// If the customer's coordinates are within the radius,
// add the customer record to the results array
if (distance <= radius) {
//Push distance value to "distance" response parameter for each object.
customers[i].distance = distance;
results.push(customers[i]);
}
}
/code/pre
Regards.