How do you access the rails 2 flash [] hash in jQuery?

Well, I'm sure there is something simple that I am missing here, but I cannot find the answer.

I have a modal one that I update with just a normal HTTP request, and now add some unobtrusive AJAX with jQuery to handle the same request.

After the controller’s action, I have user messages delivered to the flash [] hash functions (IE flash [: errors], flash [: message]). This is then displayed when redirecting to the page.

My question is: how do I access this hash scheme in my answer to the .js file? I want to do something like:

$("#message").append(ADD FLASH MESSAGE HERE || render a message partial)
+3
source share
2 answers

jquery , (html) . :

$("#message").append('<%= flash[:error] || render(:partial => :my_msg_partial) %>')
+1

- flash.to_json

0

All Articles