On Wednesday 23 August 2006 08:17, Tobias Brandvik wrote:
> Hi,
>
> Is it possible to have an ajax call to a controller function that
> returns an html fragment that has been through a template?
>
> What I want is something like this:
>
> @expose(templates.fragment)
> def get_fragment(self, title):
>    return dict(title=title)
>
> and then have a kid template that looks like:
>
> <div id="fragment">$title</div>
>
> and have this div returned to the client. This way you don't have to
> create all the HTML using javascript on the client.
>
> I think there is a expose argument called "fragment" that might help
> with this, but it doesn't seem to be covered in the docs.

This just "works" - use the normal kid templating, and set the result on an 
element using the innerHTML-property. 

I had to use a proper doctype declaration when doing so, as my template 
started with a div.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to