javascript - Rails redirect_to after jquery $.post -
Why can not my browser go to a new page when I submit it?
I think there is a button that posts and functions data in my controller.
My coffee script: create tokens controller # log file looks like this works: but the page I'm on can not change Is obtained. On which page do I specify the page in the "redirect_to" row, how do I create it? You can do the following: Do you want to use
$ Post "/ token / create", Json
redirect_to root_path, notice: 'parser successfully created I went.'
to get started / "create / token / 2014" Make 127.0.0.1 -10-08 10:27:39 -0400 as processing by * TokenController # * ... as found in http: // localhost: 3000 / full 302 in 372 (active record: 10.0ms) "/" For 127.0.0.1 2014-10-08 10:27:40 -0400 by Visitors Controller as processing # index * / * ... In 2009 complete OK 2891ms (view: 2886.6ms | ActiveRecord: 3.0ms)
def = # Do some things if request.xhr? # If the test is an AJAX call render JS: "document.location = '# {root_path}'" else redirect_to root_path, notice: 'the parser was created successfully.' End
flash in AJAX cases too? Check this answer: (and well, give your answer if it helps you)
Comments
Post a Comment