Hi there, I have a strange error: In a controller, I have a... redirect_to :action => ''show'' ...at the end. But upon code execution, Firebug tells me: syntax error <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> (It says that for Line 0) Does anyone have a clue what this means and where the problem lies? Just in case: - I have also tried to use the "loose" version in the HTML code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> But it didn''t change anything. - redirect_to a different :action works. Thank you for any help with this! Tom -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2009-Apr-19 19:44 UTC
Re: redirect_to results in "syntax error" for <!DOCTYPE HTML...>
On Apr 19, 8:29 pm, Tom Ha <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi there, > > I have a strange error: > > In a controller, I have a... > > redirect_to :action => ''show'' > > ...at the end. But upon code execution, Firebug tells me: >Sounds like you redirected to an html page but your stuff on the page was expecting to get some javascript back (ie you were using link_to_remote etc.. without an :update option) Fred> syntax error > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" > "http://www.w3.org/TR/html4/strict.dtd"> > > (It says that for Line 0) > > Does anyone have a clue what this means and where the problem lies? > > Just in case: > - I have also tried to use the "loose" version in the HTML code: > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd"> > But it didn''t change anything. > - redirect_to a different :action works. > > Thank you for any help with this! > Tom > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Tom Ha
2009-Apr-20 19:07 UTC
Re: redirect_to results in "syntax error" for <!DOCTYPE HTML...>
Thanks for your (actually super-quick) reply, Fred! To paraphrase it (correct me if I''m wrong): Whenever an Ajax request is sent (i.e. using submit_to_remote) the "rendering part" in the controller can NOT use "redirect_to :action => ..." or "render :action => ...". Rendering the response can in this case only be done using: render :update do |page| page.replace_html ''whatever'', :partial => ''whatever'' end "redirect_to" and "render" can only be used after "regular" requests. -- Posted via http://www.ruby-forum.com/.
Frederick Cheung
2009-Apr-20 19:10 UTC
Re: redirect_to results in "syntax error" for <!DOCTYPE HTML...>
On 20 Apr 2009, at 20:07, Tom Ha wrote:> > Thanks for your (actually super-quick) reply, Fred! > > To paraphrase it (correct me if I''m wrong): > > Whenever an Ajax request is sent (i.e. using submit_to_remote) the > "rendering part" in the controller can NOT use "redirect_to :action => > ..." or "render :action => ...". > > Rendering the response can in this case only be done using: > > render :update do |page| > page.replace_html ''whatever'', :partial => ''whatever'' > end > > "redirect_to" and "render" can only be used after "regular" requests.It depends on whether link_to_remote, submit_to_remote etc... have been passed the :update option. - if they have then they are updating an element on the page and you need to generating a normal html fragment - if they are not then they are expecting javascript, so using render :update and so on is compulsory. Fred> > -- > Posted via http://www.ruby-forum.com/. > > >