SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Jquery ajax data :input with radio

    Hi,
    I've a form with a lot of fields so I ended up with
    Code JavaScript:
    var postData =  $('#frmUserRegister :input');
    but there is also a radio check for the sex
    so server side I receve always the same value
    Is there a way to intersect the checked radio input ?

    Bye.

  2. #2
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code JavaScript:
    var postData =  $('#frmUserRegister :input').not('input:radio').add("input[@name='sex']:checked");

  3. #3
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    Maybe this is easier?

    Code:
    var postData =  $('#frmUserRegister').serialize();
    You can then pass postData to your ajax function.

    .serialize() takes care of selecting the correct values of checkboxes/ radios/ selects etc.

  4. #4
    SitePoint Guru whisher's Avatar
    Join Date
    May 2006
    Location
    Kakiland
    Posts
    732
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That's good to know


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •