Here is a proof of concept. Needs cleanup:

class Partial(DIV):
    def __init__(self,anchor,callback):
        DIV.__init__(self)
        target="target"
#        script="""$.get({url:'%s',
#                         callback:function(value,code){$('#%s').html
(value+code)}
#                         });""" % (URL(r=request,f=callback),target)
        script="$('#%s').load('%s',{},function(r,t,c){try{d=eval('('+r
+')');window.location=d['url']}catch(e){};})" % (target,URL
(r=request,f=callback))
        self.components=[TAG.BUTTON(anchor,_onclick=script),DIV
(_id=target)]
    @staticmethod
    def redirect(url):
        import gluon.contrib.simplejson as sj
        return sj.dumps({'url':url})

def index():
    return dict(partial1=Partial('click me','mycallback1'),
                partial2=Partial('click me','mycallback2'))

def other():
    return dict(message='Other')

def mycallback1():
    return 'hello world'

def mycallback2():
    return Partial.redirect(URL(r=request,f='other'))
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to