Hi,

I'm trying to get Google Maps Directions API working with jQuery, and
I have the following code..

<script type="text/javascript">
var directionDisplay;
var directionsService = new google.maps.DirectionsService();
var map;

function initialize() {
  directionsDisplay = new google.maps.DirectionsRenderer();
  var chicago = new google.maps.LatLng(13.3358866, 74.7711944);
  var myOptions = {
    zoom:15,
    mapTypeId: google.maps.MapTypeId.ROADMAP,
    center: chicago
  }
  map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
  directionsDisplay.setMap(map);
 
directionsDisplay.setPanel(document.getElementById("directionsPanel"));
}

function calcRoute() {
  var start = "Udupi Railway Station, Udupi, Karnataka, India";
  var end = $("#end option:selected");
  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);
    }
  });
}
$(document).ready(function(){ initialize(); $
("#end").change(calcRoute);});
</script>

Where #end is a select list in the HTML.. I'm Using jQuery 1.4.. I'm
not sure as to what is going wrong.. Can you please help me with
this...

Regards
Karthik Kastury
http://twitter.com/coolkarthik88

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to