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

  • Home
  • SEARCH
  • 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 8309959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T19:17:16+00:00 2026-06-08T19:17:16+00:00

I have lots of forms on a project I’m working on. All the forms

  • 0

I have lots of forms on a project I’m working on.

All the forms pretty much go through AJAX.

    $.ajax({
        type: "GET",
        cache: false,
        url: $(this).attr("action"),
        data: ???,
        success: function(msg){
        }
    });

I want to be able to intercept these POST’s and instead run them through AJAX.

The code is written into a method that will be reused.

So the question is: How can I select all the data that was going to be passed, turn it into a query string and insert it into the data: ???, part.

Thanks

  • 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-08T19:17:19+00:00Added an answer on June 8, 2026 at 7:17 pm

    You need to intercept the submit event. Bind an event handler on your <form> elements. When encountered, stop its propagation and its default behavior by returning false from within that event handler.

    Now, you can create your .ajax() request in that handler to. To create a serialized form of your form-data into a query-string, use jQuerys .serialize() method on that form aswell.

    For instance:

    $('#myFormId').on('submit', function( event ) {
        $.ajax({
            type: "GET",
            cache: false,
            url: $(this).attr("action"),
            data: $(this).serialize(),
            success: function(msg){
            }
        });
    
        return false;
    });
    

    Or just create that as delegated event, which handles all of your forms, like

    $(document).on('submit', 'form', function( event ) {
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page with lots of forms on it and every form has
I have multiple forms for lots of products on my page and want to
I have a fairly complex view that has multiple forms, lots of validations on
I have lots of forms in my MVC3 application that require the user to
I have a B2B we app having lots of forms taking input from registered
I'm using codeigniter in my project. I have lots of data with special characters
I have a form with lots of data. There is a Submit button. Upon
I have a file containing lots of data put in a form similar to
Well,i have a weird question to ask,sometimes when designing a form and using lots
I have lots of details. I want to stack them within an array, can

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.