You could see View example (directions-simple.html).
In the above example from and to is given by the user but i’m trying to get
From automatically by detecting the user location through browser and To is been inputted by user.
I tried this dpaste.com/695949 but could not get it working.
Thanks in advance!!
You’ve got a number of JavaScript errors in your example at http://dpaste.com/695949. I cleaned up the core of it, getting the geolocation and setting the map center there. I think you can then go from there to figure out the directions piece, but basically you’ll need to have an input box for your user to enter the location they want to go to, and you can use the current map center as the starting point for your directions.