【发布时间】:2014-05-08 05:43:46
【问题描述】:
在某些情况下,我试图在我的 html 页面中获取一条 Flash 消息。我是 Ruby 新手,我不知道如何完成这项工作。
这是我的控制器
if @item_point > current_user.points
flash[:alert] = "You don't have enough points to buy this item"
else
end
respond_to do |format|
format.html {redirect_to '/hhr'}
format.js
end
在我的脚本中,我试图在我的 ajax 成功函数中获取它。但我无法获取它。有什么方法可以在我的 jquery 函数中或在我的视图中获取此 Flash 消息. 请帮忙。 提前致谢
【问题讨论】:
-
发布您的
script code -
添加相关的脚本和Html代码,在哪里显示flash信息。
标签: jquery ruby-on-rails ruby ajax