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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:15:55+00:00 2026-05-17T15:15:55+00:00

I have an object that is inside of a form. His value is assigned

  • 0

I have an object that is inside of a form.

His value is assigned to an ajax call like this

var $$ = $(this);
if (typeof settings.data == 'string') {
   data = settings.data + '&' + this.name + '=' + $$.val();
 } else if (typeof settings.data == 'object') {
data = settings.data;
    data[this.name] = $$.val();
 }

I want to get the parent form of this element, and to loop through all inputs and add that too to the data to be used on an Ajax call.

I want the input name to be the key for the data array.

Probably something like:

var form = $$.parents('form:first');

and next thing to loop through the inputs and attach to data.

How to do that using jQuery?

  • 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-17T15:15:56+00:00Added an answer on May 17, 2026 at 3:15 pm

    I think you’re reinventing the wheel here, there’s already a .serialize() method specifically for this, like this:

    var data = $(this).closest("form").serialize();
    

    Or if you want an object representation you can loop through/add to, you can use .serializeArray() then manipulate it before passing it as the data option. It’s unclear exactly what you’re after, but it sounds like you just want to pass the entire form as the data argument to $.ajax() or a short-hand version, in which case .serialize() would be perfect.

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

Sidebar

Related Questions

I have this code snippet inside a function that checks if an object exists
I have an ajax form that I would like to submit, and the response
I have a collection object that implements IList. Inside the collection I have used
I have a list object List<Documents> , and inside that I have another list
I have a html page that looks like: <html> .. <form post=/products.hmlt ..> ..
I have a comments object that I can save changes with when a form
I have a soap web service with method: string startReaction(object reaction); Inside that method
I have a class that holds another objects inside it (List, Set and objects
I have two tables: object that has object_id column and avalues that have object_id
I have an object that represents a food item to order at a restaurant.

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.