提交表单后清除表单 [英] Clear the form once form submitted
本文介绍了提交表单后清除表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
使用jQuery重置多阶段表单
Possible Duplicate:
Resetting a multi-stage form with jQuery
提交表单后,另一页的响应将打印到#GameStorySys.但是输入到表单中的值仍然停留在该位置.提交表单后,表单值是否有可能消失(但表单仍应保留)?
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);
}
});
});
这篇关于提交表单后清除表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文