title: How does one pass AJAX vars from jQuery to their controller?
body: <p>I have an email form. But I'm making a test email form where a user can add a unique email, and have the email test send it to that particular email. </p>
  
  <p>To make it easy, I decided to make the test email perform via ajax, and stick the whole thing inside of the other email form.</p>
  
  <p><strong>I can't figure out how to send the variables from my HAML to my controller</strong></p>
  
  <p><strong>new.html.haml</strong></p>
  
  <pre><code>- form_tag admin_email_blast_path do
    Subject
    %br
    = text_field_tag 'subject', :class =&gt; "mass_email_subject"
    %br
    Body
    %br
    = text_area_tag 'message', '', :name =&gt; 'editor1', :class =&gt; "mass_email_body"
    %br/
    = submit_tag 'Send Email', :class =&gt; 'button'
  
    .grid_3.right.align_right.suffix_1  # &lt;= TEST EMAIL :D
      = text_field_tag 'email', nil, :style =&gt; "width: 150px;", :class =&gt; "test_email_address"
      = link_to 'Test Email',  test_email_admin_email_blast_path, :class =&gt; 'button test_email'
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$(".test_email").live("click", function() {
  
    var email = $(".test_email_address")
    var subject = $(".mass_email_subject");
    var body = $(".mass_email_body");
  
    data = "email=" + email.val() + "&amp;subject" + subject.val() + "&amp;body" + body.val();
  
    $.ajax({type: "GET", 
            url: $(this).attr("href"), 
            dataType: "script"
            data: data
            });
    return false;
  });
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>def test_email
    debugger
    email = params[:email]
    subject = params[:subject]
    body = params[:body]
    Notifier.deliver_email_blast(email, subject, body)
  end
  </code></pre>
  
  <p><strong>routes.rb</strong></p>
  
  <pre><code>admin.resource :email_blast, :member =&gt; {
                                  :test_email =&gt; :get
                                  }
  </code></pre>
  
  <p>I apologize ahead of time if this is a dumb newbie question. :(</p>