title: Geolocation using current location as variable
body: <p>I have adapted this code to try and get it to work for my situation. What I am attempting to do is find the visitors current location, and map directions to a certain location on load.</p>
  
  <pre><code>&lt;script src="https://maps.googleapis.com/maps/api/js?v=3.exp&amp;sensor=false"&gt;  
  &lt;/script&gt;
  
  &lt;script&gt;
    var directionsDisplay;
    var directionsService = new google.maps.DirectionsService();
  
    function initialize() {
      directionsDisplay = new google.maps.DirectionsRenderer();
      var mapOptions = {
          zoom: 7,
          center: new google.maps.LatLng(38.3094610,-85.5791560)
      };
  
      var map = new google.maps.Map(document.getElementById('map-canvas'),mapOptions);
      directionsDisplay.setMap(map);
      directionsDisplay.setPanel(document.getElementById('directions-panel'));
      var control = document.getElementById('control');
      control.style.display = 'block';
      map.controls[google.maps.ControlPosition.TOP_CENTER].push(control);
    }
  
    function calcRoute() {
      var start = 'current location';
      var end = ('38.3094610,-85.5791560');
      var request = {
          origin:start,
          destination:end,
          travelMode: google.maps.TravelMode.DRIVING
       };
  
      directionsService.route(request, function(result, status) {
         if (status == google.maps.DirectionsStatus.OK) {
             directionsDisplay.setDirections(result);
         }
      });
    }
  
    google.maps.event.addDomListener(window, 'load', initialize);
  
  &lt;/script&gt;
  </code></pre>
  
  <p>What I'm needing is to store the current location in a variable so I can use it in the
  calcRoute function as start.</p>