Advertisement

09.09.2008 at 07:53AM PDT, ID: 23715705
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.0

Simple Google Distance Calculation giving error

Asked by theitguyfromny in Extensible Markup Language (XML), JavaScript, PHP Scripting Language

Tags: , ,

Here's my code, simple enough:


<html>
<head>
<script type='text/javascript' src='http://www.google.com/jsapi?key=ABQIAAAAoN9kM0QqONCLIWU4yHeIJhSgG_jKAmzdssu2U-M8Edy2G0i_1hSCzKKxGUYV0SPXEMkIwZR4qQPugQ'></script>
<script type='text/javascript'>
//<![CDATA[

google.load('maps', '2');
var gdir2;
var gdir37;
var gdir140;
var gdir225;
function load() {
  if (GBrowserIsCompatible()) {
    gdir2 = new google.maps.Directions();
    google.maps.Event.addListener(gdir2, 'load', handleLoad);
    gdir2.load('from: 413 Old Ithaca Road Horseheads NY 14845 to: 79 Spencer Rd,Candor,NY 13743', {getSteps: true});

    gdir37 = new google.maps.Directions();
    google.maps.Event.addListener(gdir37, 'load', handleLoad);
    gdir37.load('from: 413 Old Ithaca Road Horseheads NY 14845 to: 305 Grant Ave  1,Endicott,NY 13760', {getSteps: true});

    gdir140 = new google.maps.Directions();
    google.maps.Event.addListener(gdir140, 'load', handleLoad);
    gdir140.load('from: 413 Old Ithaca Road Horseheads NY 14845 to: RT 23 ,Norwich,NY 13815', {getSteps: true});

    gdir225 = new google.maps.Directions();
    google.maps.Event.addListener(gdir225, 'load', handleLoad);
    gdir225.load('from: 413 Old Ithaca Road Horseheads NY 14845 to: 30 South Broad St  1,Norwich,NY 13464', {getSteps: true});

  }
}


function handleLoad(){
  document.getElementById('2').innerHTML=gdir2.getDistance().html;
  document.getElementById('37').innerHTML=gdir37.getDistance().html;
  document.getElementById('140').innerHTML=gdir140.getDistance().html;
  document.getElementById('225').innerHTML=gdir225.getDistance().html;
}
window.onload = load;
</script>

</head>
<body>
855520939<br />
<b>Side Hill Acres Goat Farm</b><br />79 Spencer Rd<br />Candor,NY  13743
<div id='2'>...</div><br>
<b>Down to Earth Whole Foods</b><br />305 Grant Ave, 1<br />Endicott,NY  13760
<div id='37'>...</div><br>
<b>Evans Farmhouse and Creamery</b><br />RT 23 <br />Norwich,NY  13815
<div id='140'>...</div><br>
<b>Solstice Whole Foods and Herbs</b><br />30 South Broad St, 1<br />Norwich,NY  13464
<div id='225'>...</div><br>

Done!
</body>
</html>

It runs fine and updates all DIVs w/ accurate distances, but the Browser consistently gives a gdir140.getDistance().html is null or not an object error on line 38, which is the "  document.getElementById('225').innerHTML=gdir225.getDistance().html;" line in my handleLoad function.

In the end, this is all to be a hidden function in between when a user types in an address and sees a list of addresses sorted by distance (nearest to farthest). My plan is to put the distance data in a temporary dB table (probably named using the SessionID) and then load it to the "Results" page from the dB (very, very easy). I know I could use a client-side array or something like that, but my way will work, too...I just gotta solve this Javascript error thing first.

Thanks!Start Free Trial
[+][-]09.09.2008 at 08:16AM PDT, ID: 22428294

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 10:45AM PDT, ID: 22430164

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 11:00AM PDT, ID: 22430331

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 11:06AM PDT, ID: 22430381

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 11:28AM PDT, ID: 22430583

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 11:38AM PDT, ID: 22430669

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.09.2008 at 02:05PM PDT, ID: 22432263

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Extensible Markup Language (XML), JavaScript, PHP Scripting Language
Tags: HTML, Google maps API, Javascript
Sign Up Now!
Solution Provided By: b0lsc0tt
Participating Experts: 2
Solution Grade: A
 
 
[+][-]09.09.2008 at 02:06PM PDT, ID: 22432277

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.10.2008 at 05:29AM PDT, ID: 22437575

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]09.10.2008 at 08:47AM PDT, ID: 22439578

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]09.11.2008 at 07:51AM PDT, ID: 22450506

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_Related_20080208