I have a rails 4 app where I have a script like:
<script type='text/javascript'>
$(function (){
$(document).on("change",".selectProduct", function (){
var selectValue = $(this).val();
alert("<%= render 'product_form/test', f:builder %>");
});
});
</script>
Basically, what I want to do is have the selectValue (which is the value of a select), be rendered in the ruby code. So something like:
var selectValue = $(this).val();
alert("<%= render 'product_form/#{selectValue}', f:builder %>");
.jstemplate in Rails view and interpolate it in Javascript.