我试图让使用Ajax表单验证,所以这是我到目前为止:阿贾克斯没有成功
$.ajax({
type: "POST",
url: "../includes/loginSystem.php",
data: "username=" + username + "&password=" + password,
beforeSend: function() {
alert("LOADING....");
},
success: function (html) {
alert("success!");
if (html.split(",")[0] == "true") {
sessionStorage.setItem("loggedIn", true);
loginEr.html("null");
alert("true!");
$("#login-modal").modal("hide");
$("#navbar-nav2").html("<button id='profileBtn5' class='btn btn-default' data-toggle='modal' data-target='#profile-modal'><?php echo " + html.split(",")[1] + "; ?></button>")
} else if (html.split(",")[0] == "false") {
sessionStorage.setItem("loggedIn", false);
loginEr.html(LOGIN_FAIL);
alert("false!");
}
}
});
有什么错呢?因为它总是让我看到beforeSend内容,不办任何事情的成功..
什么是你的浏览器说? –
您是否在您的js开发人员工具的网络选项卡中看到任何内容,或者在服务器的日志文件中看到有关传入连接的任何内容? –
不,我没有看到任何东西...... – GreenCubeGames