title: Rails 3 - respond_to as JS and flash message
body: <p>After send a form I will process a data from form and wanna to render an action as JS. This work me. 
  But + this functionality I would like to add a flash message yet. I try to do it as follows:</p>
  
  <pre><code>respond_to do |format|
    if @save.update_attributes(params[:data])   
      format.js {     
        flash[:notice] = 'The article was successfully updated.'
        render :update do |page|; page &lt;&lt; "$('#my_div').html('#{escape_javascript(render(:partial =&gt; 'article'))}');" end
       }
      format.html {} 
    else
      format.html { render :action =&gt; "edit" }
      format.xml  { render :xml =&gt; @data.errors, :status =&gt; :unprocessable_entity }
    end
  </code></pre>
  
  <p>Now the flash message is not displayed. Could anyone help me, why not? I tried the line with <code>flash[:notice]</code> move to out of <code>format.js</code> block, but the is still not displayed...</p>
  
  <p>Could you help me, please, why?r</p>