There's no magic to automatically take care of what you are trying to  
do (unless I've overlooked some very interesting functionality).

If you want to fetch an XHTML snippet from an AJAX request you need  
to explicitly return that XHTML by specifying a template containing  
that snippet.

If you want to return only the changed values and modify the page  
using javascript you could return them as JSON using:
        return dict(tg_format='json', data=data)

Cheers,
Chris


On 2 Jul 2007, at 15:52, venkatbo wrote:

>
> Thanks Chris.
>
> It was my typo mistake... This is what I meant:
>
>    ...
>   @turbogears.expose(format="xhtml-strict")
>   def default(self, *args, **kwargs):
>      ...
>      if first_req1:
>         # send kid-template and data to be filled in
>         ...
>         return dict(tg_template="xyz",
> autorefresh_url=url_after_1st_req,
>                        data=data...)
>      else:
>         # all subsequent accesses (via url_after_1st_req)
>         # send just the data...
>         return dict(data=data)
>
> The first access to the page works properly as expected, with
> kid template engine rendering the content. The template name is
> specified in the returned dict.
>
> In this particular ajax scenario, the first rendering of the page has
> already happened at the browser. So, doesn't the 2nd request
> onwards be just for the xhtml snippet, that will be replaced by JS
> at the browser. The whole idea was to avoid resending the whole
> page every time - need to send just the xhtml snippet so it
> can be replaced by JS (innerHTML) at the broser... If that is
> the case, is there a need to specify the template for 2nd
> req onwards... I thought it should not be necessary, hence
> I left it out of the dictionary being returned.
>
> The error msg shows up only for the 2nd request.
>
> Can't seem to find a simple recipe to do this at the TG site
> or the book... especially, with refreshed triggered manually
> or by a timer fired on the 1st rendered page.
>
> Thanks,
> /venkat
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to