Php 在xhr.Send中发送多个变量
请帮我找出其中的错误:Php 在xhr.Send中发送多个变量,php,javascript,Php,Javascript,请帮我找出其中的错误: var username = document.getElementById("username_input").value; var password = document.getElementById("password_input").value; var password_confirm = document.getElementById("password_confirm").value; xhr.open('POST', 'header/onsubmit_ch
var username = document.getElementById("username_input").value;
var password = document.getElementById("password_input").value;
var password_confirm = document.getElementById("password_confirm").value;
xhr.open('POST', 'header/onsubmit_check.php');
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xhr.send("username=" + username + "&password"= + password +"&password_confirm=" + password_confirm);
我不确定你剩下的代码是什么样子,但也许你忘了
var xhr = new XMLHttpRequest();
编辑:无需担心,找到它:
更改此项:
"&password"=
为此:
"&password="
可能是什么DOM错误?或者未定义
xhr
?在哪里定义了xhr
?您应该在.send()
调用中使用encodeURIComponent
对用户名
、密码
和密码进行编码确认
?你检查过Javascript控制台了吗?非常感谢……糟糕的错误:)