PDA

View Full Version : reset form()


eric float
02-23-2009, 03:06 PM
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 ?
$(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;
});
})

harbingerOTV
02-24-2009, 07:26 PM
take a look at that
http://www.learningjquery.com/2007/08/clearing-form-data

$('#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