Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: reset form()

  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    59
    Thanks
    0
    Thanked 0 Times in 0 Posts

    reset form()

    hi ! i have captcha form in my form . when send data with submit change captcha auto and reset form . ( with out jquery ) now : with jquery send data worked but not reset form after send data . how to reset form with jquery or reset any field ( captcha field ) after submit ?
    Code:
    $(document).ready(function() {
     
    	$().ajaxStart(function() {
    		$('#loading').show();
    		$('#result').hide();
    	}).ajaxStop(function() {
    		$('#loading').hide();
    		$('#result').fadeIn('slow');
    	});
     
    	$('#myForm').submit(function() {
    		$.ajax({
    			type: 'POST',
    			url: $(this).attr('action'),
    			data: $(this).serialize(),
    			success: function(data) {
    				$('#result').html(data);
    			}
    		})
    		return false;
    	});
    })

  • #2
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,801
    Thanks
    8
    Thanked 131 Times in 129 Posts
    take a look at that
    http://www.learningjquery.com/2007/0...ring-form-data

    PHP Code:
        $('#myForm').submit(function() {
            $.
    ajax({
                
    type'POST',
                
    url: $(this).attr('action'),
                
    data: $(this).serialize(),
                
    success: function(data) {
                    $(
    '#result').html(data);
                }
            })
                  $(
    this).clearForm()
            return 
    false;
        }); 
    that might work. havent tested it though
    Stop making things so hard on yourself.
    i is tugbucket :: help raise tugburg :: Whitehaven Kiwanis


  •  

    Posting Permissions

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