jquery/jquery-tmpl — Issue #159: Is it possible to return just the rendered HTML code?
Author: martinbean
Created: 2011-10-13 17:00:48+00:00
State: open

I'm building an application with the Google Maps API which contains markers that create InfoWindows when clicked.

Obviously an InfoWindow requires a content string, so I'm wondering if I can use this plugin to create the InfoWindow HTML string that has my data injected from an API?

For example, my JavaScript code would:

1. Create a map in the `

` element
2. Do an AJAX call to my API's URL for the list of items
3. Create InfoWindow HTML template using jQuery TMPL plugin
4. Iterate over items fetched via step 2, creating a marker for each and setting up my event listeners
5. When a marker is clicked the InfoWindow's content is changed using my template HTML injected with item data

Is this possible? I'm unsure as to how I would use the chaining options available (`.appendTo()` etc) in a Google Maps InfoWindow scenario?

Thanks in advance.