From: cz Date: 2011-02-15T20:05:25+09:00 Subject: Assign Ruby string value to Javascrip variable? Hi: Is it possible to assign a ruby string value to a javascript variable? I can display the ruby value on the browser. It looks fine, but when I try to pass the value to a javascript variable, an error ocurrs (unterminated string literal). The code snippet below is my attempt. var str = '<%= #{@str} %>'; I also tried the Ajax approach and that didn't work either. I am knew to Ruby, Sinatra, and Haml. That being said, I am surprised at how difficult this stuff is. Java and pHP were much easier. Any help or hints would be greatly appreciated. Thanks in advance. cz