javascript - how to POST radio button values through jquery -
i have example code:
while ($row = mysql_fetch_object($result1)) { echo '<input type="radio" name="vote" value='.$row->avalue.'/> '; echo '<label >'.$row->atitle.'</label><br>'; }
this displays 4 radio buttons alongwith labels. using following jquery function post.
$("#submit_js").click(function() { $.post( "user_submit.php", {//how post data?}, function(data){ }); });
i want post value associated radio button. how select value? how determine radio button selected , post it?
$("[name='vote']:checked").val()
value of selected radio button.
$("#submit_js").click(function() { $.post( "user_submit.php", {vote: $("[name='vote']:checked").val()}, function(data){ }); });
Comments
Post a Comment