$.ajax({
type: "POST",
url: "addDB.php",
data: "name=" + name + "&id=" + id + "&college=" + college + "&branch=" + branch + "&year=" + year + "&phone=" + phone + "&email=" + email + "&event=" + event,
success: function(msg) {
$("#overlay").css("display", "none");
if (msg == 'error') {
alert("Some error occurred");
} else if (msg == 'exists') {
alert("This email id is already registered.");
} else if (msg == 'done') {
alert("Registration Successfull");
} else {
alert("Some another error occurred");
}
}
});
答案 0 :(得分:0)
您收到一条成功消息,但您没有将您的msg转换为addDB.php中后端的有效JSON对象。
在addDB.php中尝试此操作,无论您在何处定义“msg”
json_encode(['msg' => 'done']);
exit();