Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Getting distance between two points

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) { 

                 &#47;&#47;Push distance value to "distance" response parameter for each object&#46; 
                 customers[i]&#46;distance = distance; 

                 results&#46;push(customers[i]); 

             } 
         } 

/code/pre

Regards.

Deon
Posts: 0
Joined: Sun Jun 30, 2013 6:00 am

Getting distance between two points

Ha ha. I knew it was going to be something so simple. Show you my js is not so good.

Yurii, thank you very much. I know its not your job to teach me Jscript, but I really do appreciate your assistance!

Return to “Issues”