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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:57:56+00:00 2026-06-09T14:57:56+00:00

Im trying do build a form using ajax. I read this tutorial, but it

  • 0

Im trying do build a form using ajax.

I read this tutorial, but it is not clear to me.

I would like to submit a simple form and show the result in the same page without refresh a page. I do not have models in my application. I just wanna submit a form, make a request to a api and show the result back to the page.

If I use this for example:

<form method="post" action="/my_controller/my_action" class="button_to" data-remote="true" data-type="json">
  <input type="text" ..>
  <input type="text" ..>
  <div><input value="Show" type="submit" /></div>
</form>

How can I get this values in my_controller and how can I show back to the view?

Thanks for any help

  • 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-06-09T14:57:58+00:00Added an answer on June 9, 2026 at 2:57 pm

    Your form

    <form method="post" action="/my_controller/my_action" class="button_to" data-remote="true"       data-type="script">
      <input type="text" name="value1">
      <input type="text" name="value1">
      <div><input value="Show" type="submit" /></div>
    </form>
    

    Your display div tag

    <div id="feeds"></div>
    

    Your action

    def my_action
       @value1 = params[:value1]
       @value1 = params[:value2]
       respond_to do |format|
          format.js
       end       
    end
    

    Your view my/my_action.js.erb

    $('#feeds').prepend("<%= j ("<p>#{@value1}-#{@value2}</p>") %>");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to build a web app like this using php, it has
I'm trying to build a form using symfony2, but I keep getting the error
I'm trying to build a form using the Zend_Form component, but the number of
I have a small demo contact form that I'm trying to build using Ajax.
I am trying to build a form with multiple autocompleted fields. I am using
I'm trying to build a simple HTML text editor in a Windows Form application.
I'm trying to build a simple form in a c++ win32 console application. instead
I'm trying to build a custom search form using PHP and I'm looking for
I'm trying to build a basic contact form using jQuery. The markup is essentially
I'm working with ExtJS4 and trying to build a search feature using a form.

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.