SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Sep 2008
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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.

    Code:
    <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

    Code:
    $("#frmRegister").validate({
    	
    			
    		rules: {
    			username: {
    			required: true
    			
    			},	
    			
    		},
    			messages: {
    			username: "This field is required.",
    			
    			}
    		
    			
    		});
    Now after validation i want to submit using ajax
    Code:
     $.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

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,702
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •