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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -