Thank you all for your replies, I really appreciate them :). In response to those who requested me to get the page up publicly; I have done so here http://aspspider.net/DarkStorm490/ . Click 'Change2' button to execute the calcDistance function.
On Oct 20, 1:05 am, Rossko <[email protected]> wrote: > You should abandon the use of document.write > When that's used _after_ the webpage has been rendered, it generally > destroys the webpage. At the moment I am only using those document.write lines just to see the values, I don't plan to keep them in there. On Oct 20, 1:05 am, Rossko <[email protected]> wrote: > You should abandon the use of document.write > When that's used _after_ the webpage has been rendered, it generally > destroys the webpage. > Getting directions takes time from the remote service, so not only do > you need to use the results only after they have become available > (i.e. in the callback) - you don't want to be doing document.writes > at that time either. > > Using setTimeout to wait for the return of asynchronous data is a dumb > idea, you have no idea how long it might take. Use the callback > facility - as soon as the data has arrived, the callback function that > you defined runs. Simple and efficient. > > Which leads to the next obvious improvement, if you have more than one > request and want to queue them one at a time, the place to handle the > queuing is in that callback function too. "Here's the response, lets > process that .... then set up the next request". -- You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
