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 7574301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:24:11+00:00 2026-05-30T16:24:11+00:00

I have what I think is a very simple problem. I’m coming from a

  • 0

I have what I think is a very simple problem. I’m coming from a PhP background, and used to do this all the time, so I may be looking at this the wrong way.

I am trying to create an ajax handler in RoR. When the user clicks a button, javascript fires off a POST, and gives the user feedback using the “success:” parameter of jQuery’s ajax function.

The problem is, RoR is trying to load a view for the ajax handler, when I really just need a few lines in the controller to do the database work, and echo out a status code that will be interpreted by the user’s javascript.

This is all just a mailchimp subscribe holding page, so I am only using the ‘home’ controller.

My Routes;

map.root :controller => 'home'
map.connect '/mcsubscribe', :controller => 'home', :action => 'mcsubscribe'

My Home Controller;

class HomeController < ApplicationController
  def index
    # no content
  end
  def mcsubscribe
    print params[:email]
  end
end

And my testing javascript, just so you understand what’s going on;

function mcSubscribe() {
    var email = jQuery("#signup_input_email").val();
    jQuery.ajax({
        type: "POST",
        url: "http://domain.com/mcsubscribe",
        data: "email=" + email,
        cache: false,
        success: function(result) {
            alert(result);
        }
    });
}

I thought this would be a common problem, but I’ve googled around and only managed to find suggestions to redirect, as the user will never visit the /mcsubscribe page, that doesn’t seem appropriate.

  • 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-30T16:24:12+00:00Added an answer on May 30, 2026 at 4:24 pm

    Using

    print params[:email]
    

    will just print that value to the application logs, not into the response.

    You want this:

    render :text => params[:email]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This problem is very simple i think... I dont have experience with big scalable
I have fully isolated this problem to a very simple play app I think
This should be a very simple problem you would think. I have a box
I have what I think is a very simple problem (famous last words)... I
I have downloaded and added this very simple, one file, php web file explorer
I have - I think - a very simple problem I want to align
I am learning LINQ and have a very simple question that I think will
I think I may have found a bug in PHP's crypt() function under Windows.
I have a very simple problem. I have an application which is written in
It might be very simple but I think I am missing something. I have

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.