Hi,

> I followed your suggestion and was able to inect jquery_js to my
> controller.  However, I am running into a problem.  Below is the
> sample code.  I expect to see the time (id=timetest)  to be updated
> everytime I click on "get time" link; however, it does not.   Hope you
> can shed a light on it.   Thanks much in advance. -tpn
> 
> From my controller  (root.py):
> =====================
> 
>  @expose('helloworld.templates.about')
>     def about(self, **kw):
>         import time
>         jquery_js.inject()
>         return dict(now=time.ctime())
> 
>     @expose()
>     def time(self):
>         import time
>         return dict(now=time.ctime())

Any reason you don't import time *once* on top of the module? It doesn't 
change the semantics, but local imports should only be used when there 
is good reason - circular dependencies or lazy loading.


> 
> 
> From my template:
> ==============
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>                       
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <html xmlns="http://www.w3.org/1999/xhtml";
>       xmlns:py="http://genshi.edgewall.org/";
>       xmlns:xi="http://www.w3.org/2001/XInclude";>
> 
>   <xi:include href="master.html" />
> 
> <head>
>   <meta content="text/html; charset=UTF-8" http-equiv="content-type"
> py:replace="''"/>
>   <title>Learning TurboGears 2.0: Quick guide to the Quickstart pages.</title>
>   <script type="text/javascript">
>      $(document).ready(function(){
>        $('a').click(function(event){
>            $('#timetest').load("/time")
>        });
>      });
> 
>    </script>
> </head>
> 
> <body>
>   <div id="timelink"><a href = "#">get time</a></div>
>   <div id="timetest" py:replace="now"></div>
> </body>
> </html>

Two questions:

  - what does FireBug say? Does the call work, is there real network 
activity?
  - some browsers aggressively cache the requests, so it's a good idea 
to randomize or add a timestamp to queries like load("/time").

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


Reply via email to