I'm using http://malsup.com/jquery/form/
very simple, how do I make it so it submits then resets my form? I know next to nothing about ajax
Using jQuery - this will reset all text fields (text and passwords). If you need to reset other fields (checkboxes...) you will need to clear those also:
$(document).ready(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
alert("Thank you for your comment!");
$('#myForm').find("input[type=text] input[type=password], textarea").val("");
});
});
$(".submit").click(function() {
$(this).closest('myForm').find("input[type=text], textarea").val("");
});
or
$('#myForm')[0].reset();
or
$('#myForm').trigger("reset");
You can use the HTML DOM Form reset() function:
...
// Selects the first (index 0) #myForm element and calls the reset method
// (the reset method is available to any HTML DOM form element)
$('#myForm')[0].reset();
...
After your submit or success of your ajax call add something like:
$("#form").submit(function(){
//your ajax call
$("#forum")[0].reset();// or document.getElementById("forum").reset();
}
or:
$.ajax({
...
success: function(...){
$("#forum")[0].reset();// or document.getElementById("forum").reset();
}
});