On Nov 14, 2010, at 8:31 AM, leone wrote: > > Right, i must be more specific. > I have javascript code that call back (by ajax) a controller function > in which i compute variables sent from ajax and i redirect forward a > new address with args. > Python code is simple but doesn't redirect using redirect(URL(...)). > Is it possible redirect from python code (raising something), or i > must return back to javascript?
I think you need to return the new URL to javascript (as the return value of the Ajax call) and let javascript do the redirection. If I understand your description, the redirection is being returned as the response to the Ajax call; the browser doesn't see it as a request to load a new page into the window unless javascript tells it to. > Thanks. > > On Nov 14, 4:34 pm, qqsaqq <sla...@gmx.net> wrote: >> I assume you mean a redirect from within the browser, after recieving >> the ajax response and evaluating the retrieved data. >> In that case you must set the window.location object in your >> javascript. In the view you could do smthg like that: >> >> <script> >> //... your callback code here >> window.location.href = {{=URL("way2go.html")}}; >> </script> >> >> On 14 Nov., 10:23, leone <handja...@gmail.com> wrote: >> >> >> >> >> >> >> >>> Hi all, >>> how can I use redirect() inside a ajax callback? >>> Thanks in advance >>> leone