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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:08:30+00:00 2026-06-12T16:08:30+00:00

I have multiple forms on one page and i am submitting them via Ajaxform

  • 0

I have multiple forms on one page and i am submitting them via Ajaxform plugin like this

<td>  <form> form1 </form> </td>
<td>  <form> form2 </form>  </td>

var options = {
            target:        '.ajaxMessage',  
            dataType: 'json',  // pre-submit callback 
            success:     function(data, statusText, xhr, form){ myResponse(data,form)},
            context: { element: this},

            cache: false,
            delegation: true,
            type: 'POST'   }; 

            $(".rform").ajaxForm(options); 

In mY AjaxSetup , i have this

beforeSend:function(xhr, settings){

        $this = settings.context.element;       
        alert($this);

But its not working , alert says window object

  • 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-12T16:08:31+00:00Added an answer on June 12, 2026 at 4:08 pm

    When you are creating options, “this” is referring to window.

    Not sure what you want this to refer to in beforeSend, but it would probably be easiest to just set it to a jQuery reference… like so:

    <form id="form1">...</form>
    <form id="form2">...</form>
    

    and for your context object:

    context: { element: $('#form2') },
    

    Updated after Comment
    I see. This isn’t elegant, but you can use the plugin’s beforeSubmit callback to set a global variable to the form (which is passed into that callback,) and then access that in your beforeSend callback.

    It might even be better to just put your code in beforeSubmit callback.

    (this all assumes you’re using this ajaxForm plugin.)

    Updated with Example:

    var options = {
      ...
      beforeSubmit: function(arr, $form, options) {
         // save the form somewhere we can get it later:
         $.MyActiveForm = $form;
      }
    

    Now in your onSend function you can access $.MyActiveForm

    But, I still think you’re better off just doing whatever you were going to do in the onSend function, in beforeSubmit, unless you need to intervene at that particular point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple slider forms in my page: like this one . For just
I have multiple forms like so: <form method=post action=change.php id=form1> <input name=product_id type=hidden value=abc
On my page I have multiple forms all the same as this... <form class='bill-upd'>
I have multiple forms on a page, for each of them I want the
I have a page with multiple forms that I submit via Ajax POSTs serially.
I have a Django project that, on one page, has multiple forms (in different
I have a question concerning multiple similair forms on one page. Lets say you
How is it possible to have multiple forms on a page with each one
I've got a page with multiple forms that load via ajax. Each form includes
I have a template page expecting two forms. If I just use one 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.