Topic: AJAX and "flash"-like messages?
I'm using some AJAX to create a form, and when the form is saved, I want to give the user some information. I have a flash area in my layout, and I'd like to use this same area if at all possible. I know I could have an html tag somewhere and use RJS to display a message, but does anyone know if there's a way to combine the flash items and an AJAX form?
I was also thinking about possibly combining the flash layout and the AJAX informational messages into one area like this:
<% if @msg %><div id="notice"><%= @msg %></div>
<% else %>
<% if flash[:notice] %><div id="notice"><%= flash[:notice] %></div>
<% end %>
That way, if I'm using AJAX to set the @msg to something, it won't use the flash items; but then, the flash items will use the location when the @msg doesn't exist. Does anyone see any obvious problems with this, or know of a better way of implementing it? Thanks for any insight or help.