Rails 3 app doesn't redirect after AJAX form submission?

I found a way to fix it. Per ruby-forum.com/topic/168406#945053 I added the following to my application controller.

I found a way to fix it. Per ruby-forum.com/topic/168406#945053, I added the following to my application controller: def redirect_to(options = {}, response_status = {}) if request. Xhr?

Render(:update) {|page| page. Redirect_to(options)} else super(options, response_status) end end This prevents the redirect response from being delivered via xhr. If there's a more "correct" way of doing this in the controller, I'd like to hear it, though.

You can do like below : in allpication. Js $(document). Ready(function(){ $(document).

AjaxError( function(e, xhr, options){ if("401" == xhr. ResponseText) { $(location). Attr('href','/users/sign_in'); } }); }) and controller's method has below code: respond_to do |format| format.

Html {redirect_to @new_user_session_url} format. Js { render :text=>'401' ,:status=>401} end But I think there is better way to do so....

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions