So I''ve got a few forms that update info using Ajax and form_remote_tag. I''ve got a javascript function that I call from within my render method in my controller, to take the contents of the flash and display them in a div that appears and then disappears. I''m using the following: render :update do |page| page << ''ShowMessage("'' + escape_javascript(flash[:notice]) + ''");'' .... end however, it fails to work if the flash message contains single quote characters. I''ve now tried the following variations: # works with double quotes, fails with single quotes page << "ShowMessage(''" + flash[:notice] + "'');" # works with double quotes, fails with single quotes page << "ShowMessage(''" + escape_javascript(flash[:notice]) + "'');" # fails with double quotes, works with single quotes page << ''ShowMessage("'' + flash[:notice] + ''");'' # works with double quotes, fails with single quotes page << ''ShowMessage("'' + escape_javascript(flash[:notice]) + ''");'' So unfortunately, I can''t get any of the above variations to handle both double quotes and single quotes.. I can only get it to work with one or the other. If someone can please tell me how to properly escape this, or what I''m doing wrong, I''d really appreciate it.. This is driving me crazy! Thanks, Mike