Making the browser switch pages isn't too bad. Just set
document.location to the new url using javascript. (The document
object should be provided by the browser.)
Maybe you should check the headers of the ajax response and if it is a
redirect make the redirect happen using javascript? Or simply make one
of the ajax responses be {"redirect_to": "http://www.example.com/"}
and parse it out on the client side.Hope that helps, Alex On Sep 15, 2:07 am, Margie Roginski <[email protected]> wrote: > I have a situation where the user fills in a form and hits submit to > post the form. If my views.py code detects an error in the form, I > want to return some info to the client and put it into the dom via > jquery. If there is no error, I want to redirect to another page. > Can anyone advise me on the best way to do this? I've succesfully > used $.post() to grab the error info and put it in the dom. However, > in the case where there is no error, I can't figure out how to do the > redirect. > > I've tried having the views.py code pass back the url that I want to > redirect to, and then when my $.post() callback function is called, it > sets window.location to that url. But this seems to have some issues > when the url contains an anchor (for some reason firefox seems to > cache anchored urls and not redirect to them in the normal way). > > Is there any way to specify that even though $.post() started the > server request, that the server should just redirect to a url (ie, > using just the basic HttpResponseRedirect() or something like that) > and not return and call the $.post callback function? > > Thanks for any pointers, > > Margie --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django 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/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

