0

I am running into an error loading my map because of my info window for a marker on my map. In the info window I want a link for the directions, so I was going to pass the destination coordinates in the URL. But it does not like the syntax I am using, I am getting no errors though.

var contentString2 = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3 id="firstHeading" class="firstHeading"><a name="FLOSSMOOR STATION RESTAURANT & BREWERY"></A><strong><A HREF="redirect.cfm?address=http://www.flossmoorstation.com" TARGET="_blank">FLOSSMOOR STATION RESTAURANT & BREWERY</A></strong></h3>'+
'<div id="bodyContent">'+
'<p><a href="index.cfm?in='document.write(initialLocation);'+'&'+'document.write(myLatlng2);'+'">Directions</a></p>'+
'</div>'+
'</div>';

with this variable for the info window I get the lovely grey screen with out the map loading, also is there a better way going about making the info-window div? thanks!

3
  • It would be useful to show the contents of index.cfm, and the parts of the code that assign values to initialLocation and myLatLng. At a minimum, I suspect that myLatLng is actually a LatLng object and not something that can be sent to document.write() with expected results. Also, when you say you are not getting errors, where are you looking for errors? Are there any errors appearing in your JavaScript console? Commented May 24, 2011 at 21:17
  • No errors in the javascript console, if I can't send it to document.write() is there another way I could get a LatLng object into the URL? Commented May 24, 2011 at 21:21
  • Probably. What do you expect the LatLng object to look like when you send it to document.write()? Commented May 24, 2011 at 22:01

1 Answer 1

1

If myLatlng2 is a LatLng object in Google Maps API v3 then you should likely at a minimum change this in your URL construction:

document.write(myLatlng2)

To something more like this:

document.write(myLatlng2.toUrlValue())
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.