$(function($)
{
$("#btnSubmit").click(function ()
{
//Set the Valid Flag to True if one RadioButton from the Group of RadioButtons is checked.
var isValid = $("input[name=gender]").is(":checked");
//Display error message if no RadioButton is checked.
$("#spnError")[0].style.display = isValid ? "none" : "block";
}),
$(\'#contact_form\').validate(
{
rules:
{
uname:
{
required:true,
minlength:3,
maxlength:15
},
uemail:
{
required:true,
email: true,
minlength:3,
},
upass:
{
required:true,
minlength:3,
maxlength:15
},
cpass:
{
required:true,
equalTo:\'#inputpassword\'
},
uaddres:
{
required:true,
minlength:3,
maxlength:100
},
gender:
{
required:true
},
ucity:
{
required:true,
minlength:2,
maxlength:15
},
ustate:
{
required:true
},
uzip:
{
required:true,
minlength:6,
maxlength:6
}
},
messages:
{
gender:
{
required:\'\'
}
},
submitHandler:function(form)
{
event.preventDefault();
var nameid = $("#inputname").val();
var emailid = $("#inputemail").val();
var passid = $("#inputpassword").val();
var addid = $("#inputaddress").val();
var genderid=$(\'#inputgender[name="gender"]:checked\').val();
var cityid = $("#inputcity").val();
var stateid = $("#inputstate").val();
var zipid = $("#inputzip").val();
var link="<?php echo admin_url(\'admin-ajax.php\'); ?>"
var form_data=$(\'#contact_form\');
$.ajax({
url: link,
type: \'post\',
data:
{
action:\'contact_form_data\',
data:form_data.serialize()
},
beforeSend:function()
{
$(\'.loader\').show();
},
success: function (response)
{
msg="<div>"+response+"</div>";
$(\'#msg\').html(msg);
console.log(response);
$("#contact_form")[0].reset();
$(\'.loader\').hide();
}
});
}
});
});