how to POST radio button values through jquery

javascript, jquery

Solution

`$("[name='vote']:checked").val()` will get you the value of the selected radio button.

$("#submit_js").click(function() {
  $.post(
  "user_submit.php", 
  {vote: $("[name='vote']:checked").val()}, 
  function(data){
  });
});

Problem

i have this example code: ``` while ($row = mysql_fetch_object($result1)) { echo '<input type="radio" name="vote" value='.$row->avalue.'/>&nbsp;'; echo '<label >'.$row->atitle.'</label><br>'; } ``` this displays 4 radio buttons alongwith their labels. now I am using the following jquery function to POST. ``` $("#submit_js").click(function() { $.post( "user_submit.php", {//how to POST data?}, function(data){ }); }); ``` I want to post the value associated with the radio button. but how do i select the value? how do i determine what radio button is selected and POST it?

Original source