当表单提交后页面未重定向,可能是由于以下原因导致的:
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// 处理表单提交逻辑
// ...
// 重定向到另一个页面
response.sendRedirect("/thankyou");
}
$.ajax({
url: "/submit",
method: "POST",
data: formData,
success: function(response) {
// 处理成功逻辑
// 重定向到另一个页面
window.location.href = "/thankyou";
},
error: function() {
// 处理错误逻辑
}
});
请根据您的具体情况检查和调试代码,并根据需要进行适当的更改。