I'm try to pass the from value (radio button) via ajax. The value sent but wrong. I have 4 radios but the form keeps sending the first value (==1). Could you guys please give me some suggestions. Why it happening?
Here's my code:
<ul class="nav nav-list">   
<li><label for="1"><input type="radio" name="vote" id="1" class="choice" value="1"> Choice 1</label></li>  
<li><label for="2"><input type="radio" name="vote" id="2" class="choice" value="2"> Choice 2</label></li>
<li><label for="3"><input type="radio" name="vote" id="3" class="choice" value="3"> Choice 3</label></li>
<li><label for="4"><input type="radio" name="vote" id="4" class="choice" value="4"> Choice 4</label></li>
    <li class="divider"></li>
    <li>        
        <div id="vote_loading" style="display:none">loading...</div>
        <div id="vote_result"></div><button class="btn btn-small btn-success" type="button" onClick = "voting()"><i class="icon icon-thumbs-up icon-white"></i> Vote</button>
    </li>
</ul>
<script src="http://code.jquery.com/jquery-latest.js"></script>
    <script>
    //voting
    function voting(){
         var choice = $('.choice').val();
         $.ajax({
             type: "POST",
             url: "inc/vote_chk.php",
             data: {choice:choice}
             }).done(function(result){
             $("#vote_loading").slideUp("slow");
             $("#vote_result").html(result).slideDown("slow");
         });
    }
    </script>
By the way I'm using bootstrap. But it's no matter with the code.
Regards,
 
     
     
     
    