Question

I am using jquery-ui-map (http://code.google.com/p/jquery-ui-map/) to render golf courses on a map. I am bringing in the courses through an XML feed. I can get the points to render correctly, but each info window is exactly the same (the last item in the XML feed).

URL: http://www.madebysprung.com/playground/gmaps/test/

XML: http://www.madebysprung.com/playground/gmaps/test/map.xml

I am building the HTML for the info box in the variable called "markerhtml". I then pass markerhtml to the content of the info box.

I appreciate any help you can give me on this one. Thanks!

Était-ce utile?

La solution

This is a variable scope issue. You didn't declare a local variable named markerhtml in your code. You can add it below the lat and long variables.

lat = $(this).find("lat").text();
long = $(this).find("long").text();
var markerhtml;

Also, note that you should rename the variable from "long" to "lng" (or something else). long was a reserved word in JS at one point. It's a bit cleaner to not use it.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top