Ruby on Rails
Friday, February 7, 2014
On Thursday, 6 February 2014 16:52:12 UTC-5, bertly_the_coder wrote:
Hi guys,Is this possible? I have an action triggered off as JS, which i respond to appropriately, but sometimes, the request fails at which point I'd like to change to respond_to format to html so that I can redirect to a thank you page. So far I've tried:redirect_to(thank_you_path, format: 'html') and return if @next_question.nil?but this still tries to redirect it as a js response, which of course fails......is there anyway I can convert a JS request to an HTML response?
I don't think this would work, even if it was possible - the code on the web browser end is still expecting a JS response, and trying to execute HTML as Javascript will not turn out well.
As an alternative, what if you rendered some JS that changed `window.location` to the thank-you page? (sometimes described as a "client-side redirect")
--Matt Jones
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/93564e86-dd3a-4aea-a92d-6ff0ea442cab%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment