【发布时间】:2009-10-18 08:06:06
【问题描述】:
我正在使用 html、javascript 和 mod_python。我想提交html表单。为此,我使用了
document.formName.submit();
提交后我想重定向到新页面。我试过 location="newpage.html" 但这不起作用。
【问题讨论】:
标签: javascript html mod-python
我正在使用 html、javascript 和 mod_python。我想提交html表单。为此,我使用了
document.formName.submit();
提交后我想重定向到新页面。我试过 location="newpage.html" 但这不起作用。
【问题讨论】:
标签: javascript html mod-python
除非您使用 AJAX 提交表单,否则提交会将用户带到一个新页面,因此您无法执行 javascript 重定向。
您可以在服务器端重定向,或更改表单的操作。
【讨论】:
使用 ajax 提交表单。然后onSuccess回调,设置window.location = new_url。
【讨论】:
Req.write('<script>location.href="page.py?fn=xxx";</script>')
在提交时要执行的python函数的末尾
【讨论】: