Forum: Ruby on Rails How to use flash in javascript?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
pinnacle (Guest)
on 2006-03-20 14:15
The following code can not run:

<div id="aaa">This is a test</div>
<script>
    function foo(id)
    {
        Element.hide($(id));
  <% for name in [:notice, :warning, :message] %>
    <% if flash[:notice] %>
        Element.hide($(abc));
    <% end %>
  <% end %>
    }
</script>

How to combine the <%= %> pairs with the javascript code?
Alex Y. (Guest)
on 2006-03-20 14:43
(Received via mailing list)
pinnacle wrote:
> The following code can not run:
>
> <div id="aaa">This is a test</div>
> <script>
>     function foo(id)
>     {
>         Element.hide($(id));
>   <% for name in [:notice, :warning, :message] %>
>     <% if flash[:notice] %>
Is that a typo, or do you mean flash[name]?
This topic is locked and can not be replied to.