rails code within javascript

Posted by Jesse on Stack Overflow See other posts from Stack Overflow or by Jesse
Published on 2010-03-18T04:48:18Z Indexed on 2010/03/18 4:51 UTC
Read the original article Hit count: 220

Filed under:
|
|
|

I am trying to use some rails code withing a javascript and need to have that rails code be dynamically changed. Here's the line of code:

$(this).replaceWith("<%= escape_javascript(render(:partial => 'shared/products')) %>");

The 'shared/products' is the part I want to change based off information passed earlier in the javascript. How do I insert a value from javascript so that instead of 'shared/products' the products portion can be a variable? Hope this makes sense. I'm not the most experienced jQuery/javascript programmer, so any help is very much appreciated. Thanks in advance!

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about jQuery