如何从 index.html.erb 中的 action1、action2 和 action3 呈现 javascript?在索引操作中,我需要运行这些操作,并且在它们完成后,我需要使用警报通知它们已完成......但是 rails 不会多次渲染,有解决方法吗?
控制器:
def index
action1
action2
action3
end
def action1
# do some process
#send a javascript alert "action1 finished" (but display that alert in the index)
end
def action2
# do some process
#send a javascript alert "action2 finished" (but display that alert in the index)
end
def action3
# do some process
#send a javascript alert "action3 finished" (but display that alert in the index)
end