Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1100091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:49:50+00:00 2026-05-17T00:49:50+00:00

I have an email form. But I’m making a test email form where a

  • 0

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.

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.

I can’t figure out how to send the variables from my HAML to my controller

new.html.haml

- form_tag admin_email_blast_path do
  Subject
  %br
  = text_field_tag 'subject', :class => "mass_email_subject"
  %br
  Body
  %br
  = text_area_tag 'message', '', :name => 'editor1', :class => "mass_email_body"
  %br/
  = submit_tag 'Send Email', :class => 'button'

  .grid_3.right.align_right.suffix_1  # <= TEST EMAIL :D
    = text_field_tag 'email', nil, :style => "width: 150px;", :class => "test_email_address"
    = link_to 'Test Email',  test_email_admin_email_blast_path, :class => 'button test_email'

JS

$(".test_email").live("click", function() {

  var email = $(".test_email_address")
  var subject = $(".mass_email_subject");
  var body = $(".mass_email_body");

  data = "email=" + email.val() + "&subject" + subject.val() + "&body" + body.val();

  $.ajax({type: "GET", 
          url: $(this).attr("href"), 
          dataType: "script"
          data: data
          });
  return false;
});

Controller

def test_email
  debugger
  email = params[:email]
  subject = params[:subject]
  body = params[:body]
  Notifier.deliver_email_blast(email, subject, body)
end

routes.rb

admin.resource :email_blast, :member => {
                                :test_email => :get
                                }

I apologize ahead of time if this is a dumb newbie question. 🙁

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:49:51+00:00Added an answer on May 17, 2026 at 12:49 am

    You could use the data parameter:

    $('.test_email').live('click', function() {
    
        var subject = $('.mass_email_subject');
        var body = $('.mass_email_body');
    
        $.ajax({
            type: 'GET', 
            url: this.href, 
            dataType: 'script',
            data: { subject: subject.val(), body: body.val() }
        });
        return false;
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a website with a contact form. User submits name, email and message
I have a simple jsp form that the customer uses to send us emails.
I have a textarea in a form that will eventually be an email form.
I have tried all the combinations I can think off but this form: class
Right now I have an asp:Wizard with 3 Steps. Create User Form to Email
On a standard web signup form, users are required to have a unique email
I have a basic PHP form here that sends an email when submitted: <div
I have a tell a friend pop up email form that allows users to
I have a form that pops up when the user clicks a link and
I have an email subject of the form: =?utf-8?B?T3.....?= The body of the email

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.