Try this:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<title></title>
<script type='text/javascript'>
var btnClick =function () {
var _rating = document.getElementById('rating').options[document.getElementById('rating').selectedIndex].value;
alert(_rating);
var _author = document.getElementById('author').value;
var _email = document.getElementById('email').value;
if(_author!="" && _rating!="Rate" && _rating!="")
{
alert("fdgg");
var data = [
{
"_author": _author, "_email": _email, "_rating": _rating
}];
$.ajax(
{
type: "POST",
url: "Item_desc.aspx/Save_Comment",
dataType: "json",
data: JSON.stringify({ Cust_Comments: data }),
contentType: "application/json; charset=utf-8",
success: function (json) {
alert("dgsjhgdfdjhg");
}
});
}else
{
return false;
}
return true;
};
</script>
</head>
<body>
<form action="#" method="post" id="commentform" onsubmit="return false">
<p class="comment-form-author">Name *<input id="author" name="author" type="text" value="" size="30" aria-required="true" required="required" />
</p>
<p class="comment-form-email">Email<input id="email" name="email" type="text" value="" size="30" /></p>
<p class="comment-form-rating"><label for="rating">Rating</label>
<select name="rating" id="rating" required="required">
<option value="">Rate…</option>
<option value="5">Perfect</option>
<option value="4">Good</option>
<option value="3">Average</option>
<option value="2">Not that bad</option>
<option value="1">Very Poor</option>
</select>
</p>
<p class="form-submit">
<input name="submit" type="submit" id="submit" value="Submit Review" onclick="btnClick();" />
</p>
</form>
</body>
</html>