Jsp 通过AJAX成功插入数据后重定向到另一个页面
成功插入日期后,我想重定向到另一个JSP页面Jsp 通过AJAX成功插入数据后重定向到另一个页面,jsp,jquery,Jsp,Jquery,成功插入日期后,我想重定向到另一个JSP页面 $.ajax({ type: "post", url: "register.jsp", data: datastring, success:function(){ window.location.href = "nextPage.jsp"
$.ajax({
type: "post",
url: "register.jsp",
data: datastring,
success:function(){
window.location.href = "nextPage.jsp";
}
但我无法重定向到另一个页面(nextPage.jsp),但将数据插入数据库是成功的。如何重定向到
另一页
我也试过了
success:function(){
$("divid").load("nextPage.jsp") }
但这也不起作用。而不是这样做
window.location.href = "nextPage.jsp";
这样做
使用
var url='/your_jsp';
window.location.replace(url);
var url = '<%=request.getContextPath()%>/your_jsp';
window.location.replace(url);