Reputation: 25827
I am beginner in rails.
I have view that i try to print inside him @myvar inside js alert.
%script(type="text/javascript")
alert(@myvar);
But nothing happens, What should I change?
Upvotes: 0
Views: 603
Reputation: 230531
First of all, you should be using :javascript
filter instead of %script
definition. In javascript filter you are able to use string interpolation. Try this:
:javascript
alert(#{@myvar});
Upvotes: 2