You don't need to go to the server to do a redirect. Try this:
<select id="treeCb" name="treeCb"
onchange="window.location.href='{{=URL(r=request,f='index')}}'+'/'+jQuery(this).val();">
<option value="111">111</option>
<option value="222">222</option>
</select>
If you are doing an ajax call for something other reason and
redirecting after, you can do:
<select id="treeCb" name="treeCb" onchange="ajax('/test/default/
treeCbChange', ['treeCb'],':eval');">
<option value="111">111</option>
<option value="222">222</option>
</select>
def treeCbChange():
return "window.location.href='%s'" %
URL(r=request,f='index',args=request.vars.treeCb)
On Mar 16, 11:22 am, toan75 <[email protected]> wrote:
> I have:
>
> in view:
> <select id="treeCb" name="treeCb" onchange="ajax('/init/data/
> treeCbChange', ['treeCb']);"><option value="111">111</option><option
> value="222">222</option></select>
>
> in control:
>
> def treeCbChange():
> try:
> redirect(URL(r=request, f='index/'+request.vars.values()[0]))
> except:
> print 'error'
>
> But it can't redirect (it print 'error').
>
> How am I supposed to do it?
> Regards
> Toan
--
You received this message because you are subscribed to the Google Groups
"web2py-users" 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.