如何在不使用javascript重新提交表单的情况下重新加载页面?

时间:2014-06-19 17:04:44

标签: javascript html forms post reload

我正在开展一个小型股票管理项目。将项目添加到数据库后,重置按钮停止工作。我能够重置除了html-5日期属性和复选框之外的所有内容,使用javascript这样

$form.find('input:text, input:password, input:file, select,textarea').val('');           
$form.find('input:radio, input:checkbox, input:dropdown').removeAttr('checked').removeAttr('selected');

所以,我正在尝试使用
完全重新加载页面 location.reload(true);
 但是,现在它提示要求重新提交表单。有什么可以解决这个问题?有没有其他方法可以重置表单?

抱歉,我是编程新手。我很感激你的帮助。

1 个答案:

答案 0 :(得分:0)

在服务器端脚本中,添加项目后,重定向到同一页面而不是直接显示它。服务器端脚本的伪代码:

而不是:

if(additem() == success)
{
   display_form()
}

这样做:

if(additem() == success)
{
   redirect('/your/form_url')
}
相关问题