0
我正在製作一個網站,我有一個signup.php頁面,用戶可以在其中註冊並將其信息輸入到mysqli數據庫中。當我這樣做,我幾乎沒有,我只是不停地在這一行獲得了一個問題:用戶註冊註冊錯誤
ajax.send("&u="+u+"&e="+e+"&p="+p1+"&g="+g);
它基本上是發送變量的AJAX/JavaScript的檢查,準備運輸到服務器。但是我在這條線上遇到了內部服務器500錯誤。有任何想法嗎?如果你想要,我會發布更多的代碼。
function ajaxReturn(x){
if(x.readyState == 4 && x.status == 200){
return true;
}
}
function signup(){
var u = _("username").value;
var e = _("email").value;
var p1 = _("pass1").value;
var p2 = _("pass2").value;
var g = _("gender").value;
var status = _("status");
if(u == "" || e == "" || p1 == "" || p2 == "" || g == ""){
status.innerHTML = "Fill out all of the form data";
} else if(p1 != p2){
status.innerHTML = "Your password fields do not match";
} else {
_("signupbtn").style.display = "none";
status.innerHTML = 'please wait ...';
var ajax = ajaxObj("POST", "signup.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
if(ajax.responseText != "signup_success"){
status.innerHTML = ajax.responseText;
_("signupbtn").style.display = "block";
} else {
window.scrollTo(0,0);
_("signupform").innerHTML = "OK "+u+", check your email inbox and junk mail box at <u>"+e+"</u> in a moment to complete the sign up process by activating your account. You will not be able to do anything on the site until you successfully activate your account.";
}
}
}
type:post;
ajax.send("&u="+u+"&e="+e+"&p="+p1+"&g="+g);
}
}
我得到的東西看起來像這樣的陣列(1){[「PHPSESSID」] =>字符串(32)「be48f6f5071fe91a3d5f6c654652a3da」} – elliotanderson
所以,它聽起來像變量沒有正確發送到服務器。查看使用jQuery的AJAX請求示例的更新答案。 – Travesty3