$(document).ready(function(){    
	 $("#submit").click(function(e){
            var fname = $("#fname").val();
                    var lname = $("#lname").val();
                    var mail =  $("#mail").val();
                    var phone =  $("#phone").val();
                    var age =  $("#age").val();
                    var type =  $("#type").val();
                    var address =  $("#address").val();
                    var state =  $("#state").val();
                    var zip =  $("#zip").val();
                    $.ajax({
                        type:'POST',
                        url:"/addEnquiry",
                        data: { fname : fname,
                                lname : lname,
                                mail : mail,
                                phone : phone,
                                age :age,
                                type : type,
                                address : address,
                                state : state,
                                zip : zip,
                        },                      
                        success:function(data) {
                            //location.reload();
                        }
                    }); 
       });
            $("#submit").validate({ 
                    submitHandler: function(form) {
                        form.submit();
                    },
                    rules: {
                        email: {
                            required: true,
                            email: true
                        },
                        password: {
                            required: true,
                            minlength: 5
                        },
                        confirmPassword: {
                            required: true,
                            minlength: 5,
                            equalTo: "#password"
                        },
                    },
                    messages: {
                        email: "Please enter a valid email address",
                        password: {
                            required: "Please provide a password",
                            minlength: "Your password must be at least 5 characters long"
                        },
                        confirmPassword: {
                            required: "Please provide a password",
                            minlength: "Your password must be at least 5 characters long",
                            equalTo: "Please enter the same password as above"
                        },
                        
                    }
                });
		
	});
