View code inside Javascript file on Rails

Posted by SpyrosP on Stack Overflow See other posts from Stack Overflow or by SpyrosP
Published on 2011-03-12T07:11:59Z Indexed on 2011/03/12 8:10 UTC
Read the original article Hit count: 234

Filed under:
|

Hello, previously i had javascript code right in the top of my view and it would work. Then, i learned that you can include the js file using yield and i did just that.

I had rails view code inside my javascript code like :

    $( "#exp-progressbar" ).progressbar({
            value: <%= ((@quest.end_time - Time.now).to_i * 100 ) / (@quest.duration * 60) %>
});

Now, after i do it with yield, i get an error when i do that in the separate js file. How can i do it now ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ruby-on-rails