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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:54:29+00:00 2026-05-16T16:54:29+00:00

I have a form with different groups of checks boxes and trying to pass

  • 0

I have a form with different groups of checks boxes and trying to pass all the selected values into an array then pass that data into a ajax request.

$('#accessoriesOptions input').each(function(index, value){
    if($(this).attr('checked') ){
        var newItem =[];
        var obj = {};
        obj[$(this).attr('value')] = $(this).attr('name'); //I have an hash table with the key-value
        wizard.searchArray.push(obj);
    }            
})

$.ajax({
   data : wizard.searchArray
})

I get a wizard.searchArray like :

   [0] = {'acc_1' : 'vase'},
   [1] = {'acc_3' : 'ceramic'}

I need to create a key-value as I use the key to work out which part of the filtering to use.

The problem

When I do the ajax request, from firebug I see the request as :

/wizard-demo/?undefined=undefined&undefined=undefined

  • 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-16T16:54:30+00:00Added an answer on May 16, 2026 at 4:54 pm

    In this case just push add the properties to the obj and use it directly, that’s the pair that’ll get serialized property when used as the data property, like this:

    var obj = {};
    $('#accessoriesOptions input').each(function(index, value){
        if(this.checked){
            obj[this.value] = this.name;
        }            
    })
    
    $.ajax({
       data : obj
    });
    

    Though this is backwards from a normal <form> submission, if that’s what you want it’s this instead:

    obj[this.name] = this.value;
    

    If you wanted to send the entire form, there’s a much shorter/built-in .serialize() method for this:

    $.ajax({
       data : $("#accessoriesForm").serialize()
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm dynamically pulling and displaying radio button quesitons on a form (separated into different
I want to achieve a form using css which have different panels for different
I have a form that needs to allow people to search for hikes, hiking
I have created an ASP.NET 3.5 form page. At the top I have placed
I have 3 different radio button group in jQuery like so: <tr class=toValidate> <td>Please
How I love regex! I have a string which will be a mangled form
I have an ASP.NET MVC 2 project in which I've created a data transfer
I have a list of integers, for example 1,2,2,3,4,1 . I need to be
I would like to pick some of your brains on this matter... I've got
I'm returning data via JSON and attempting to loop through the JSON dataset to

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.