$.ajax({
url: "NewUserRegistrationServlet",
type: "post",
cache: false,
data : "username="+username+"&password="+encodeURIComponent(pswd)+"&email="+encodeURIComponent(email),
dataType:"xml",
timeout: 3000,
success: function(data) {
var xml_node = $('ResultSet',data);
var status = xml_node.find('result').text() ;
var result = xml_node.find('status').text() ;
if((result > 0) && ( status == 'SUCCESS')) {
alert("This Statement is getting executed");
//window.location.replace("login.jsp"); // Not Working
//window.location.href = 'http://localhost:8080/MyProj/login.jsp'; // Not Working
window.open = ('login.jsp','_top'); // Not Working
}else{
$("#RegisErr").siblings("p").remove();
$("#RegisErr").after("<p>User Registration failed! Please Try Again.</p>");
}
},
error: function(xhr, status, text) {
$("#RegisErr").siblings("p").remove();
$("#RegisErr").after("<p>User Registration failed! Please Try Again.</p>");
}
});
我在做什么错误jQuery的AJAX页面重定向错误
- 的OnSubmit - >确认形式的//工作正常
- 如果合法 - >做Ajax请求//工作精细
- 关于Ajax的成功 - >重定向到其他JSP页面//不要催眠
编辑
截图Chrome的调试
解决
windows.location = "login.jsp"
谢谢大家对你的帮助。
你得到哪些错误? – 2014-10-07 07:28:51
也许'NewUserRegistrationServlet'中缺少扩展文件... ??? – Xlander 2014-10-07 07:29:28
@PhilippM它不是重定向login.jsp页面? – KumarDharm 2014-10-07 07:32:55