是否有可能在我的JS中添加其他功能:
如果响应==成功重定向到home
如果响应==失败重定向失败
$.ajax({
type: "POST",
url: action,
data: form_data,
success: function(response) {
if (response == 'success')
window.location.replace("home");
else
$("#message").html("<div class='error_log'><p class='error'>Invalid username and/or password.</p></div>");
}
});?
Run Code Online (Sandbox Code Playgroud)
success: function(response) {
if (response == 'success')
window.location.replace("home");
else if (response == "failed")
window.location.replace("failed");
else
$("#message").html("<div class='error_log'><p class='error'>Invalid username and/or password.</p></div>");
}?
Run Code Online (Sandbox Code Playgroud)
或者你的意思是:
$.ajax({
type: "POST",
url: action,
data: form_data,
error: function() {
window.location.replace("Failed");
},
success: function(response) {
if (response == 'success')
window.location.replace("home");
else
$("#message").html("<div class='error_log'><p class='error'>Invalid username and/or password.</p></div>");
}
});?
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
48335 次 |
| 最近记录: |