title: Flash Notice on Ajax Success Rails
body: <p>I'm trying to get a flash message in my html page under some conditions. I'm new to Ruby and i don't know how to make this work.</p>
  
  <p>this is my controller</p>
  
  <pre><code>     if @item_point &gt; current_user.points
          flash[:alert] = "You don't have enough points to buy this item"
        else
        end
        respond_to do |format|
          format.html {redirect_to '/hhr'}
          format.js
        end 
  </code></pre>
  
  <p>and in my script i'm trying to get it in my ajax success function.. But i'm not able to get it .. Is there any way i can get this flash message in my jquery function or in my view.
  pls help.
  thanks in advance</p>