title: passing ruby variables to javascript (Ruby on Rails)
body: <p>I have a list of medicines and a list of vaccinations that I am extracting from tables medicines and vaccinations respectively. The list of medicines is of the format medicine_name and so is the list of vaccinations. I store both of these in vars using this piece of code.</p>
  
  <pre><code>var injections=&lt;%=@injections%&gt;;
  var medicines=&lt;%=@medicines%&gt;;
  </code></pre>
  
  <p>In my view I have select tags for medicines and injections but when I try to append these vars to the respective tags using the following code. I don't get any results please help</p>
  
  <pre><code>$('.addmedicines').click(function()
     $('.medicines').append(medicines);
  
  
  });
  $('.addinjections').click(function(){
     $('.injections').append(injections);
  });
  </code></pre>
  
  <p>Here .injections is the class assigned to select tag for vaccinations. .medicines is the class assigned to select tag for medicines. And .addmedicines and .addinjections are html buttons.</p>
  
  <p>EDITED:</p>
  
  <p>When I try to display both injections and medicines in javascript they display like this:</p>
  
  <p>Medicines:</p>
  
  <pre><code>&lt;option&gt;Med1&lt;/option&gt;&lt;option&gt;Med2&lt;/option&gt;&lt;option&gt;Med3&lt;/option&gt;&lt;option&gt;Med4&lt;/option&gt;
  </code></pre>
  
  <p>Injections:</p>
  
  <pre><code>&lt;option&gt;i1&lt;/option&gt;&lt;option&gt;i2&lt;/option&gt;&lt;option&gt;i3&lt;/option&gt;&lt;option&gt;i4&lt;/option&gt;
  </code></pre>