Submit a form using ajax after validation +jquery

hi to all,

I have a form and i am using jquery validation plugin to validate form.now i want to after validation submit form using ajax.

here is the example.


<form id="frmRegister" action="" method="Post" >
<input type="text" id="username" name="username" value="" />

<input type="submit" id="btnRegister" name="btnRegister" value="Register" />

</form>

Now in validation i have following code


$("#frmRegister").validate({
	
			
		rules: {
			username: {
			required: true
			
			},	
			
		},
			messages: {
			username: "This field is required.",
			
			}
		
			
		});


Now after validation i want to submit using ajax


 $.ajax({
					type: "POST",
					url: "./ajax.php",
					data: "catid="+ categoryvalue,
					success: function(data)
					{
							
					}
				
					});

How i validate first if validation is ok then submit form using ajax

regards

Take a look at the submitHandler

http://docs.jquery.com/Plugins/Validation/validate#toptions