I have 3 radio buttons.
<input type="radio" name="length" value="1">
<input type="radio" name="length" value="2">
<input type="radio" name="length" value="3">
and im passing this values using like this. name,bay,pall,dest working fine. but length output as "undefined". please help me to fine this error.. thanks..
this is my ajax codE:
$(document).ready(function()
{
$("#bcode").focus();
//prevents autocomplete in some browsers
$("#bcode").attr('autocomplete', 'off').keyup(function(event)
{
var name = $("#bcode").val();
var bay = $("#select").val();
var pall = $("#select2").val();
var dest = $("#select4").val();
var length = $("#length").val();
$("#status").empty();
if(name.length > 17 )
{
selectAll();
$("#status").html('<img align="absmiddle" src="images/loading.gif" /> Checking availability...').show();
$.ajax({
type: "POST",
url: "namecheck.php",
data : "bcode=" + name + "&select=" + bay+ "&select2=" + pall+ "&select4=" + dest+ "&length=" + length,
success: function(msg)
{
$("#status").html(msg).show();
}
});
}
else
{
$("#status").html('').addClass('err').s开发者_Python百科how();
}
});
});
I think this is wrong: var length = $("#length").val();
it should be
var length = $("input[name=length]:checked").val();
精彩评论