Why when I call resp.getHeader(''Location''); after my ajax call does the browser get redirected to the location header. I just want to get the value of it. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
eggie5
2007-Oct-07 02:53 UTC
Re: Prototype: resp.getHeader(''Location''); redirects browser
It turns out -- apparently -- it''ll only redirect the browser if you save it to a variable named ''location'' So this''ll redirect your browser: location = resp.getHeader(''Location''); but this wont: loc = resp.getHeader(''Location''); Anybody know why? On Oct 5, 11:45 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Why when I call resp.getHeader(''Location''); after my ajax call does > the browser get redirected to the location header. I just want to get > the value of it.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Gareth Evans
2007-Oct-07 03:57 UTC
Re: Prototype: resp.getHeader(''Location''); redirects browser
its probably a shortcut for window.location.href Gareth On 10/7/07, eggie5 <eggie5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > It turns out -- apparently -- it''ll only redirect the browser if you > save it to a variable named ''location'' > > So this''ll redirect your browser: > > location = resp.getHeader(''Location''); > > but this wont: > > loc = resp.getHeader(''Location''); > > Anybody know why? > > On Oct 5, 11:45 pm, eggie5 <egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Why when I call resp.getHeader(''Location''); after my ajax call does > > the browser get redirected to the location header. I just want to get > > the value of it. > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Nicolás Sanguinetti
2007-Oct-07 04:42 UTC
Re: Prototype: resp.getHeader(''Location''); redirects browser
"window" is the "default" namespace. All global variables are just properties of window, so doing ''location = something'' is the same as '' window.location = something''. Furthermore, window.location redirects when edited. If you want to avoid problems, then do ''var location = something'', which will declare location local to the current scope, and you won''t trigger the redirect call. Best, -Nicolas On 10/7/07, Gareth Evans <agrath-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > its probably a shortcut for window.location.href > > Gareth > > > On 10/7/07, eggie5 <eggie5-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > It turns out -- apparently -- it''ll only redirect the browser if you > > save it to a variable named ''location'' > > > > So this''ll redirect your browser: > > > > location = resp.getHeader(''Location''); > > > > but this wont: > > > > loc = resp.getHeader(''Location''); > > > > Anybody know why? > > > > On Oct 5, 11:45 pm, eggie5 < egg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Why when I call resp.getHeader(''Location''); after my ajax call does > > > the browser get redirected to the location header. I just want to get > > > the value of it. > > > > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---