Possible Duplicate:
Resetting a multi-stage form with jQuery
Once the form submitted, response from another page is printed to #GameStorySys. But values entered to the form still stays there. Is it possible for the form values to disappear (but the form should still stay) once the form submitted?
$("[name='GameStoryForm']").click(function() {
$.ajax({
type: "POST",
data: $("#GameStoryForm").serialize(),
url: "content/commentary/index.cs.asp?Process=EditLiveCommentaryStory&CommentaryID=<%=Request.QueryString("CommentaryID")%>",
success: function(output) {
$('#GameStorySys').html(output);
},
error: function(output) {
$('#GameStorySys').html(output);
}
});
});
You can clear it manually, for example:
$("[name='GameStoryForm']").click(function() {
$.ajax({
type: "POST",
data: $("#GameStoryForm").serialize(),
url: "content/commentary/index.cs.asp?Process=EditLiveCommentaryStory&CommentaryID=<%=Request.QueryString("CommentaryID")%>",
success: function(output) {
$('#GameStorySys').html(output);
$("#GameStoryForm").get(0).reset();
//or manually:
// $("#GameStoryForm :input").not(':button, :submit, :reset, :hidden')
// .val('').removeAttr('checked selected');
},
error: function(output) {
$('#GameStorySys').html(output);
}
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With