title: Javascript: put GPS coords into var
body: <p>I apologize but I'm not expert in JavaScript, I need to get Latitude and Longitude in a variable to track a route using Google Maps.</p>
  
  <pre><code>    function calcRoute() {
      var start = "position.coords.latitude,position.coords.longitude";
      var end = "&lt;?php echo $la; ?&gt;,&lt;?php echo $lo; ?&gt;";
      var request = {
          origin:start,
          destination:end,
          travelMode: google.maps.DirectionsTravelMode.DRIVING
      };
  </code></pre>
  
  <p>This code works if I write </p>
  
  <pre><code>        var start = "12.3456789,12.3456789";
  </code></pre>
  
  <p>As you can see, using PHP to put end's coords works fine. I tried different ways to use position.coords.latitude into <strong>end</strong> var but I don't understand why "position.coords.latitude,position.coords.longitude" don't change in "12.3456789,12.3456789".</p>
  
  <p>Note: I am sure position.coords.latitude and position.coords.longitude are filled correct because using an alert I can see the rights values.</p>
  
  <p>Thanks for help...</p>