Two errors. I forgot to remove the <script> tag -- it isn't needed in 
response.js because the returned JS is eval'ed. Also, in your code, you 
have request.js, but it should be response.js, so try:

response.js = '''$(function() {$(".replacewloading").click(function() 
{$(this).parent().html('<span><img 
src="static/plugin_test/images/loading.gif"/>Refreshing...</span>')} );} 
);'''

Anthony

On Wednesday, January 11, 2012 12:02:29 PM UTC-5, Liam wrote:
>
> web2py 1.99.4
>
> plugin controller:
> def overview():
>     if len(request.args) > 0 and request.args[0] == 'refresh':
>         import time
>         time.sleep(4)
>     body = H2('Component header')
>     refresh = DIV(A('Refresh', _class='button replacewloading', 
> _href=URL(c='plugin_test', f='overview.load', args=['refresh']), 
> cid=request.cid))
>     
>     request.js = '''<script>$(function() 
> {$(".replacewloading").click(function() {$(this).parent().html('<span><img 
> src="static/plugin_test/images/loading.gif"/>Refreshing...</span>')} );} 
> );</script>'''
>     
>     return dict(body=body, refresh=refresh)
>
> plugin view:
> {{=body}}
> {{=refresh}}
>
> application view:
> {{extend 'layout.html'}}
> {{=LOAD('plugin_test', 'overview.load', ajax=True)}}
>
>

Reply via email to