开发者

delete flash message injected with ajax Rails

I am using js.erb and ajax to inject a flash partial onto a page:

js.erb

$('#buttons').before($("<%=escape_javascript(render 'shared/flash', :flash => flash)%>)").fadeIn('<%=Board::FADE_IN%>').delay(<%=Board::FLASH_TIMING%>).fadeOut('<%=Board::FADE_OUT%>', function(){ $('div.flash-blcok').remove(); }))开发者_如何学Python

However I noticed that if a user refreshes the page they see the flash message in the layout.

I am using flash.now[:success] in the controller and thought that it would eliminate any flash messages but it does not seem to be working.

How can I delete the flash?


FWIW In your code snippet you may have had a misspelling.

You had:

$('div.flash-blcok').remove()

This question helped me get to a solution for my own problem. Thanks for asking it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜