使用respond_with 如何使用ajax 响应闪烁通知?
flash 方法仅在页面重新加载后显示消息...当我使用 :remote => 时,我该怎么做才能让它出现?真的?
The flash method only shows the message after the page reloads... what do I do to get it to appear when I'm using :remote => true?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在使用 :remote => true 你实际上是在做 Ajax 请求。
在这种情况下,闪光灯将无法工作。
您需要的是一个模仿该闪现消息的 js 函数。
我通常会这样:(Mootools,但你可能明白)
每当我使用 :remote =>是的,我在 js 视图中有这个
if you are using :remote => true you are actually doing Ajax request.
in that case, the flash will not work.
What you need is to have a js function that mimics that flash message.
I usually have that: (Mootools, but you probably get the idea)
Whenever I use :remote => true, I have that in the js view