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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T20:36:47+00:00 2026-05-21T20:36:47+00:00

On a page, I have several checkboxes, the id is different for each. The

  • 0

On a page, I have several checkboxes, the id is different for each. The number of checkbox is not fixed, may be one, 4, 10, … I’d like get all the id and send them via a $.post.

How can I do this ?

Thanks,

Update 1:

var jqxhr = $.post("/Controller/MyAction", {
    field1: $("#field1").val(),
    benefic: $(":checkbox").serialize(),
    fileld2: $("#fileld2").val()
},
function (data) {
})
.success(function () {
})
.error(function (jqXHR, status, error) {
})
.complete(function () {

});

I don’t see any value in my controller for “benefic” … and it’s the “id” of selected checkbox I need

  • 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-21T20:36:48+00:00Added an answer on May 21, 2026 at 8:36 pm

    Do this:

    $.post('your_url', $(":checkbox").serialize() );
    

    If your checkboxes have the same name, for example name="myCheckbox[]", you could do this:

    $.post('your_url', $(":checkbox[name='myCheckbox[]']").serialize() );
    

    Hope this helps.

    EDIT: Solution for your Update 1:

    $.post("/Controller/MyAction", {
        field1: $("#field1").val(),
        benefic: $(":checkbox:checked").attr("id"),
        fileld2: $("#fileld2").val()
    },
    ...
    

    This will do what you ask for.. but, are you sure it will always be only 1 checkbox. selected? If you need more than 1 (i’m almost sure you do), in which format do you need to send them? Ids separated by commas?

    To send all checked ids, separated by commas, you would do this:

    $.post("/Controller/MyAction", {
        field1: $("#field1").val(),
        benefic: $(':checkbox:checked').map(function() { return this.id; }).get().join(','),
        fileld2: $("#fileld2").val()
    },
    ...
    

    Cheers

    • 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 several CheckBoxList controls with 4 checkboxes in each of
I have several dropdowns on the page one under another, and would like to
I have several tabs in my application, and each tab loads a different sub-page
I have several PrimeFaces checkboxes on a page. If you click the master checkbox,
I have several ReorderLists on a page. Each list has items added to it
I have several forms on one page which are submitted using ajaxForm and show
I have several pages to do with several table on each page. I've got
If you have several view models on one page, how do you ensure that
I have an ASP.NET code-behind page linking several checkboxes to JavaScript methods. I want
So I have a table in a jsp page with several rows and checkboxes

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.