页面不跳转,在 js 里输出返回值,是我要跳转的 html。
def create
@imprint = Imprint.new(imprint_params)
@imprint.save
redirect_to @imprint
end
def show
@imprint = Imprint.find(params[:id])
end
Started POST "/imprints/" for 127.0.0.1 at 2016-01-27 11:08:53 +0800
Processing by ImprintsController#create as */*
Parameters: {"imprint"=>{"lng"=>"114.005017", "lat"=>"22.59508", "accuracy"=>"65", "text"=>"事实上"}}
(0.7ms) BEGIN
SQL (0.5ms) INSERT INTO `imprints` (`lng`, `lat`, `accuracy`, `text`, `created_at`, `updated_at`) VALUES (114.005017, 22.59508, 65, '事实上', '2016-01-27 03:08:53', '2016-01-27 03:08:53')
(7.9ms) COMMIT
Redirected to http://localhost:3000/imprints/24
Completed 302 Found in 59ms (ActiveRecord: 22.8ms)
Started GET "/imprints/24" for 127.0.0.1 at 2016-01-27 11:08:53 +0800
Processing by ImprintsController#show as */*
Parameters: {"id"=>"24"}
Imprint Load (0.4ms) SELECT `imprints`.* FROM `imprints` WHERE `imprints`.`id` = 24 LIMIT 1
Rendered imprints/show.html.erb within layouts/application (0.3ms)
Completed 200 OK in 165ms (Views: 162.2ms | ActiveRecord: 0.4ms)