表单实现无刷新页面提交,无需页面跳转,通过一个隐藏的iframe实现,form表单的target设置为iframe的name名称,
form提交目标位当前页面iframe则不会刷新页面,实现form表单提交不会跳转页面,只会出现提示
<form action="file/upload" method="post" enctype="multipart/form-data" target="targetIfr">
选择文件:<input type="file" name="file" width="120px">
<input type="submit" value="上传">
</form>
<iframe name="targetIfr" style="display:none"></iframe>