title: How to pass a javascript variable into a erb code in a js view?
body: <p>I have this Javascript view in my Rails 3 project:</p>
  
  <p>app/views/expenses/new_daily.js.erb</p>
  
  <pre><code>var i = parseInt($('#daily').attr('data-num')) + 1;
  //$('#daily').append('agrego fila ' + i + ' &lt;br /&gt;');
  
  $('#daily').append('&lt;%= escape_javascript(render(partial: 'new_expense', locals: { i: i })) %&gt;');
  
  $('#daily').attr('data-num', i);
  </code></pre>
  
  <p>I want to pass my 'i' javascript variable to a ruby partial through locals, How I can accomplish this?</p>