title: Passing in Params to JS.ERB file from controller? [Rails 3]
body: <p>I am trying to allow users to "import" saved Missions into a Syllabus post. A Syllabus has many Missions, and the Syllabus form is a nested form where the user can 'Add Missions,' which will append a new Missions textbox. </p>
  
  <p>When I "import" missions, I want the javascript to<br>
   1. click "add missions" link (which adds a nested form) <br/>
   2. input values of the "imported missions" into the ckeditor textbox.</p>
  
  <p>_IMPORT_FORM.HTML.ERB</p>
  
  <pre><code> &lt;%= form_tag(import_missions_path, :method =&gt; :post, :id =&gt; "import-js" )  do |f| %&gt;
    &lt;ul&gt;
    &lt;% current_user.folders.find_by_order(1).missions.each do |mission| %&gt;
  &lt;li&gt; &lt;%= check_box_tag "mission_ids[]", mission.id %&gt;
    &lt;%= mission.id.to_s + ". " + mission.title %&gt; &lt;/li&gt;
    &lt;% end %&gt;
    &lt;/ul&gt;
    &lt;%= submit_tag "Import ", :class =&gt; 'btn btn-primary' %&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>this then goes to SYLLABUSES#IMPORT</p>
  
  <pre><code>def import
  @missions_hash = []
      #loop through each mission id from :missions_id
  params[:mission_ids].each do |id|
   @missions_hash &lt;&lt; Mission.find(id)
  end
  respond_to do |format|
    format.html { redirect_to edit_syllabus_path(@syllabus), notice: "imported" }
    format.js { render 'folders/import.js' }
  end
  end
  </code></pre>
  
  <p>which I then want to render IMPORT.JS.ERB file, and pass in  the @missions_hash. The code below is probably wrong, and this is where I need help fixing it.</p>
  
  <p>IMPORT.JS.ERB</p>
  
  <pre><code>//loop for each mission passed in 
  &lt;% @mission_hash.each do |mission| %&gt;
    //click add missions
    $('#add-missions-button').trigger('click');
    //pass in mission.title &amp; mission.content to form textbox value
  &lt;% end %&gt;
  </code></pre>
  
  <p>What is the correct syntax to pass in the Ruby params into this Javascript.erb file? Also, I want to copy the 'title' and 'content' of the imported Missions into the newly added mission form box:</p>
  
  <pre><code>  &lt;%= f.text_field :title, :class =&gt;'row span6' %&gt;
    &lt;%= f.cktext_area :content, :toolbar =&gt; 'MyToolbar', :class =&gt; 'row span6', :rows =&gt; '5', :placeholder =&gt; "What is the first step a learner should do? (e.g. Watch an intro video, read certain article)" %&gt;
  </code></pre>
  
  <p>How would I copy it into the values of these  textboxes, so the user can edit it after importing?</p>
  
  <p>I realize this question is badly organized, but I tried to make it as simple as possible without explaining the entire background. I'm still a beginner so please understand..</p>