Skip to content Skip to sidebar Skip to footer

Rails Console Shows View Is Rendered, But Doesn't Render In Browser

This seems very weird. I have a link that I want to make an ajax call to the controller to delete a users' responses, then redirect to another page. Here's the code for the link: &

Solution 1:

You have used redirect_to action: "course_page1", format: "html" and return which is not right. Redirection will work fine if it was an html request but not ajax. So if you want to redirect despite the fact that the request was an ajax, use may something like this

format.js { render :js => "window.location.href = '#{course_page_path}'" }

Or remove the remote: true attribute from the link so it would work just fine.

Hope that helps

Solution 2:

of course, because you are using ajax, not standard call. If you want to be redirected, try to remove remote: true from link_to. Or if you want to keep using ajax, you need by jQuery do redirection from js file. In your example it should be in reset_score.js.erb

Post a Comment for "Rails Console Shows View Is Rendered, But Doesn't Render In Browser"