Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • I edited the code to reflect the entire JavaScript section of the page. I tried this solution out but it didn't work. Your help is greatly appreciated! Commented Apr 23, 2014 at 0:20
  • take your click function out of your computetotaldistance function. There is no good reason to have it in there. You also aren't doing anything with your ajax result. See the success option of my ajax function. Commented Apr 23, 2014 at 0:24
  • Thanks for your help. So I took the click function out, but should the $(document).ready(function() { encapsulate the entire javascript code or just the computetotaldistance function? Thanks again for your help! Commented Apr 23, 2014 at 0:27
  • $(document).ready() can encapsulate all your javascript, within script tags, but you should know what it does. It basically just waits until the document (DOM) has completely loaded until loading your js so for functions that manipulate the DOM it is necessary Commented Apr 23, 2014 at 0:28