I have a form in a div (actually a lightbox). I use Ajax.Updater to submit the form when some one clicks the OK button. If they don''t type some information in, the div is updated and form is displayed again. The issue is that when they successfully type in the info needed in the form, the div updates, and I need the page to forward to another location. How can I do that? I tried sending an http "Location:" header, but that only updates the lightbox div, not the entire page. When the div reloads, I tried putting this in there: <script type=''text/javascript''> <!-- window.location = ''Location: http://...'' //--> </script> But, it doesn''t appear to be running. How can I make it forward depending on whether the user successfully fills in the form? Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Perkins
2008-Mar-14 15:12 UTC
Re: prototype/javascript: how to update div then div forwards
On Fri, Mar 14, 2008 at 10:07 AM, doug <douglass_davis-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote:> The issue is that when they successfully type in the info needed in > the form, the div updates, and I need the page to forward to another locationLet me first ask obvious question: If the user is being sent to a new page upon successful form completion, what is the point of submitting the form via Ajax ?> window.location = ''Location: http://...''You want to use either window.location or location.href. I prefer the latter. You give it a string that is a URL, it''s not like a redirect header like you''re attempting to do. -justin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 14, 11:12 am, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Mar 14, 2008 at 10:07 AM, doug <douglass_da...-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > > The issue is that when they successfully type in the info needed in > > the form, the div updates, and I need the page to forward to another location > > Let me first ask obvious question: If the user is being sent to a new > page upon successful form completion, what is the point of submitting > the form via Ajax ?Because every submit is not successful. It may just redisplay the form with some error messages.> > > window.location = ''Location:http://...'' > > You want to use either window.location or location.href. I prefer the > latter. You give it a string that is a URL, it''s not like a redirect > header like you''re attempting to do.Okay, I tried it with window.location and location.href, I put just the link in there: <script type=''text/javascript''> <!-- window.location = ''http://www.somewhere.com'' //--> </script> It doesn''t even run the code in the div. I know because I even put an alert(''testing'') in there, and nothing came up. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Justin Perkins
2008-Mar-14 15:37 UTC
Re: prototype/javascript: how to update div then div forwards
On Fri, Mar 14, 2008 at 10:25 AM, doug <douglass_davis-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote:> Okay, I tried it with window.location and location.href, I put just > the link in there:Do you have evalScripts turned on for your Ajax request? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Mar 14, 11:37 am, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Fri, Mar 14, 2008 at 10:25 AM, doug <douglass_da...-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > > Okay, I tried it with window.location and location.href, I put just > > the link in there: > > Do you have evalScripts turned on for your Ajax request?oh. :) I didn''t know I had to do that. Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jonas Rosenqvist
2008-Mar-15 08:06 UTC
Re: prototype/javascript: how to update div then div forwards
If you''re doing it as an ajax request why not just call window.location in the onSucess function? As I understod it the original problem seemd to be that the lightbox was based on an iframe so try parent.window.location instead. On 14 Mar, 17:47, doug <douglass_da...-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote:> On Mar 14, 11:37 am, "Justin Perkins" <justinperk...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > On Fri, Mar 14, 2008 at 10:25 AM, doug <douglass_da...-ihVZJaRskl1bRRN4PJnoQQ@public.gmane.org> wrote: > > > Okay, I tried it with window.location and location.href, I put just > > > the link in there: > > > Do you have evalScripts turned on for your Ajax request? > > oh. :) > > I didn''t know I had to do that. > > Thanks.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---