hnchuong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Mar-31 03:00 UTC
How to make a ajax (xhr) redirect?
Hi all, In my application, I want seamless degradability so I use request.xhr? to check whether a request is an ajax call. However here and there, I need to use redirect_to - in this case the request is not xhr anymore, and the check doesn''t work as expected. Is there a way to make xhr- like redirect (which allow to get to another controller+action)? Thanks, - Chuong --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
We use this, on a page with display preferences. When a preference change is going to change most of the page, it''s just easier to redisplay the whole thing. Note that page.redirect_to(:back) doesn''t work. render :update { |page| page.redirect_to(request.env["HTTP_REFERER"]) } Regards, Lori On Sun, Mar 30, 2008 at 9:00 PM, hnchuong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <hnchuong-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi all, > > In my application, I want seamless degradability so I use request.xhr? > to check whether a request is an ajax call. However here and there, I > need to use redirect_to - in this case the request is not xhr anymore, > and the check doesn''t work as expected. Is there a way to make xhr- > like redirect (which allow to get to another controller+action)? > > Thanks, > - Chuong > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---