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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:10:01+00:00 2026-06-12T04:10:01+00:00

$(.submitinfo).each(function() { // Want to use ID as POST name // And value as

  • 0
$(".submitinfo").each(function() {
  // Want to use ID as POST name
  // And value as POST value
});
// Submit the data
$.ajax({
  url: 'submit.php',
  traditional: true,
  data: {
  'submit':'true',
  'age':$('#age').val(),
  'loss':$('#loss').val()
      // somehow include results here
},
type: 'POST',
async: false,
success: function(data) {
  alert(data);

},
error: function() {
  alert('Submit Error');
}
});

I’ve never had to do this before, and can’t find any examples of it anywhere. I have a series of inputs with a class of submitinfo that I would like to be able to submit alongside other inputs via an ajax request. How can I do this? Check the code comments for details.

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-12T04:10:03+00:00Added an answer on June 12, 2026 at 4:10 am

    Create an object, and add the values in the each function to the object, and pass that object to $.ajax as data :

    var data = {
      submit : 'true',
      age    : $('#age').val(),
      loss   : $('#loss').val()
     }
    
    $(".submitinfo").each(function() {
        data[this.id]=this.value;
    });
    
    $.ajax({
      url: 'submit.php',
      traditional: true,
      data: data,
      type: 'POST',
      async: false,
      success: function(data) {
        alert(data);
      },
      error: function() {
        alert('Submit Error');
      }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to make a form that uses jQuery's ajax function to submit the
Im trying to use if else statement in success ajax function, but the value
I have a php function which inserts a searchbar into each page on a
In my application am submiting my form by using post for a php page.
Can you serialize multiple forms into one so that only one post or ajax
I have post form with submit button before submit i need to call c#
the form is submiting as normal request instead of Ajax. $(document).ready(function () { StatusComments();
I want to put a validation that the user always enters a value in
html: <input id=save type=submit value=Create class=btn btn-primary/> javascript that register onclick (IsValid is a
I'm trying to use jquery to get data from a form and stop the

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.