Possible Duplicate:
How can I get which radio is selected via jQuery?
我正试图在我的网站上建立一个用户评级制度,但只有第一个数值已经过去,因此,在表格中,评级栏永远是个。 这是我与电台合作以来的时期。
这里是我所拥有的。
<form id="add-rateing">
<input type="radio" name="MOVIE_RATING" value="1" > 1
<input type="radio" name="MOVIE_RATING" value="2" > 2
<input type="radio" name="MOVIE_RATING" value="3" checked="yes"> 3
<input type="radio" name="MOVIE_RATING" value="4" > 4
<input type="radio" name="MOVIE_RATING" value="5" > 5 <br>
<input type="hidden" name="MOVIE_ID" value="<?php echo $id; ?>">
<input type="hidden" name="MOVIE_TITLE" value="<?php echo $title; ?>">
<input type="hidden" name="USER_ID" value="<?php echo $loggedinusername; ?>">
<input type="submit" value="I Drank To The Credits" onclick="$( #add-rateing ).hide( fast )">
</form>
<script type="text/javascript">
$("#add-rateing").submit(function(event){
event.preventDefault()
addrateing();
});
function addrateing()
{
var movie_rating_s = $("#add-rateing [name= MOVIE_RATING ]").val();
var movie_id_s = $("#add-rateing [name= MOVIE_ID ]").val();
var movie_title_s = $("#add-rateing [name= MOVIE_TITLE ]").val();
var user_id_s = $("#add-rateing [name= USER_ID ]").val();
var errors = ;
$.ajax({
type : "POST",
url : "movie_watched.php",
data : { rating: movie_rating_s,
movie : movie_id_s,
title: movie_title_s,
user : user_id_s, },
cache : false, timeout: 10000,
success : function() {
alert("You have played <?php echo $title; ?> ");
},
error : function() {
alert("there is a problom");
},
complete : function() {
}
});
};
</script>