yes you can, but where you are doing it, in the view.js.erb file?

On Tue, Feb 15, 2011 at 5:05 AM, cz <raymanojin / gmail.com> wrote:
> 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
>
>