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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:28:57+00:00 2026-05-15T20:28:57+00:00

Supposing I had a multi-form page such as: <form id=A class=jaxy … /> <form

  • 0

Supposing I had a multi-form page such as:

<form id="A" class="jaxy" ... />
<form id="B" class="jaxy" ... />
<form id="C" class="jaxy" ... />

Then I have some JQuery

$('.jaxy').live('submit', function() {
  $(this).startLoadingSpinner;
  $.post(this.action, $(this).serialize(), $(this).stopLoadingSpinner, "script");
  return false;
});

When a “jaxy” form is submitted there’s an Ajax post request and the server might respond with some script like the following:

// The code I wish I had...
// If there was an error with the form it might respond...
$(whichever_form_posted).replaceWith("<form id="B" class="jaxy" .../>")
// or if everything went well it might...
$(whichever_form_posted).empty();
alert("Everything is right with the world! Give yourself a pat on the back.");

The trouble I’m obviously having is knowing which form submitted the post request in the first place. The way is see it I have 3 possible routes:

  1. I could potentially send a DOM selector in the POST params? or
  2. I could request a HTML response and insert the response data BUT as shown above I might not want to replace so this isn’t really an option for me.
  3. My preference somehow create a $.fn.function prototype in the response that could be called on the submitting element. This would have to be carefully scoped or unique so that any subsequent form submissions didn’t redefine the function.

I’m really struggling to see a way around this and I would appreciate any thoughts on this. It’s not necessarily relevant but I’m using this in a RoR environment and the POST request is a .js response to a RESTful controller action. More of a jQuery question that a RoR one I guess.

Kind regards,

Kevin.

  • 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-15T20:28:58+00:00Added an answer on May 15, 2026 at 8:28 pm

    You’ve not mentioned what appears to be the most obvious technique: a hidden field.

    <input type="hidden" name="form_id" value="foo">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Supposing I have a StringerHelper(Component|Helper|Behaviour).php class with a method for random strings. I might
Supposing I had the following HTML: <html> <head> <title>My Test Page</title> </head> <body> I
Supposing I have 3 tables: Users, Roles and UserRoles. I can fetch the user_roles
Supposing I have one perl in /usr/bin (which came along with my os-distribution) and
Supposing I have this: foo bar 1 and foo bar 2 How can I
Supposing that I have millions of user profiles, with hundreds of fields (name, gender,
MVC newbie question re binders. Supposing I have two strongly typed partial actions that
Supposing I have 4 bitmaps, say, CMYK, all of which are 1bit/pixel and are
Up until recently I had a working service using NHibernate 2.0. I have upgraded
I have the following code in Java: public class ServerInfo { int serverId; int

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.