Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7991963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T13:26:30+00:00 2026-06-04T13:26:30+00:00

This is prob. very simple but I can’t get it. I have a href

  • 0

This is prob. very simple but I can’t get it. I have a href link e.g. <a href="includes/driving.php?lat=38.254181&long=20.649962" class="driving" >Driving instructions</a> which when clicked (using jQuery) opens a googlemap like this:

jQuery('a.driving').live('click',function(){
jQuery('#content').empty().load(jQuery(this).attr('href'), function(){
initGeolocation();
})
return false;
});

Function initGeolocation(); grabs the HTML5 location and there are more than 1 class="driving" links on the page. What I cannot get to happen is passing the lat and long variables to the map. I need to get them into this function:

function calcRoute(position) {
var start = '38.313393,20.562651';
var end   = 'lat' , 'long'
var request = {
    origin:start,
    destination:end,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
  if (status == google.maps.DirectionsStatus.OK) {
    directionsDisplay.setDirections(response);
  }
});

}

if needed the map is called like this (standard code)

function success(position) {
    var myOptions = {
      zoom: 13,
      center: new google.maps.LatLng(38.313393, 20.562651),
      mapTypeId: google.maps.MapTypeId.ROADMAP
    }
    map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
   directionsDisplay = new google.maps.DirectionsRenderer({
        'map': map,
        'preserveViewport': true,
        'draggable': true
    });
    directionsDisplay.setPanel(document.getElementById("directions_panel"));
    google.maps.event.addListener(directionsDisplay, 'directions_changed',
      function() {
        if (currentDirections) {
          oldDirections.push(currentDirections);
          setUndoDisabled(false);
        }
        currentDirections = directionsDisplay.getDirections();
      });
    setUndoDisabled(true);
    calcRoute(position);
  }

Help appreciated thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T13:26:31+00:00Added an answer on June 4, 2026 at 1:26 pm

    Hi, well if you have your co-ordinates ready, then why don’t you create google.maps.LatLng object by this way: new google.maps.LatLng(your lat, your lon), if you want to specify string then do it this way new google.maps.LatLng("address") and assign this latlng object to start and end. This will solve your problem. For more details please visit
    Google’s documentation.:)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi folks this is prob quiet simple but not sure how to do it.
This is prob more of a geometry question, but I have an array of
This question is prob a duplicate (but I can't find it) so I apologize
this is prob pretty easy but if someone could explain the easiest way to
This must be a very simple solution that has eluded me this last hour.
This is a super simple issue that I can't figure out. I want to
I know this has prob been answered, but I've searched for almost an hour
alert(window.open('http://www.google.com')); i tried this on firefox, and i get null, no prob in ie.
Prob something im overlooking but this problem has annoyed me greatly. im trying to
hi guys i have a weird prob here.. i have this dropdownlist where different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.