I do this:

function Signup() { var email = document.getElementById("email").value; var password = document.getElementById("password").value; var name = document.getElementById("name").value; var xmlhttp = getXmlHttp(); xmlhttp.open('POST', 'Signup/SignupUser.php', true); // Открываем асинхронное соединение xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); // Отправляем кодировку xmlhttp.send("name=" + encodeURIComponent(name), "password=" + encodeURIComponent(password), "email=" + encodeURIComponent(email)); // Отправляем POST-запрос xmlhttp.onreadystatechange = function() { // Ждём ответа от сервера if (xmlhttp.readyState == 4) { // Ответ пришёл if(xmlhttp.status == 200) { // Сервер вернул код 200 (что хорошо) document.getElementById("sdf").innerHTML = xmlhttp.responseText; // Выводим ответ сервера } } }; } 

The error is probably here.

 xmlhttp.send("name=" + encodeURIComponent(name), "password=" + encodeURIComponent(password), "email=" + encodeURIComponent(email)); 

But what to do, I do not know :(

  • And what is written in the error console? What exactly does not work? - Rules
  • Uncaught ReferenceError: vote is not defined - Kirpich643
  • The error falls from some other line of code and means that the variable vote is not defined. - ReinRaus


3 answers 3

Try this

 xmlhttp.send("name=" + encodeURIComponent(name) + "&password=" + encodeURIComponent(password) + "&email=" + encodeURIComponent(email)); 
    1. The specified POST method is unnecessary to set the Content-Type header.
    2. In XMLHttpRequest.send you need to input either a string, or null , and not several parameters. Combine all the parameters passed in one line through the ampersand & .

      Send them in sync.