Rails3 Redirect for javascript/ajax
I'm using a form with the remote => true
. I have a validation that is working correctly.
My problem is when the user enters all the correct information an开发者_开发百科d writes the data at this time I do a redirect to the page of the show. Instead of redirecting, it displays the html of the show in my div. How can I make a javascript redirect that will understand? I did not want to use the window.location
.
Thanks...
you need to change your Update view into an update.js.erb and supply the javascript you wish to return with. i typically use an ajax flash notice as the response.
here is a good walkthrough: http://www.whatcodecraves.com/articles/2008/12/13/rails_flash_with_ajax/
精彩评论