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.'/>&nbsp;';                     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

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -