There is a script. When registering, it displays an alert with a reason that appears from the PHP script, but if there are several reasons, you should do a line break, html tags do not work, I tried to output \ n \ r, it also does not work. Apparently you need to prescribe something in the script itself.

function register() { if(document.getElementById("five").checked) { document.getElementById('reg').disabled = true; var nick = document.getElementById("one").value; var pass = document.getElementById("two").value; var secretik = document.getElementById("three").value; var rules = document.getElementById("five").value; $.post("index.php?engine=reg_post",{login:nick,password:pass,secret:secretik,rule:rules} , function(data) { alert (data); document.getElementById('reg').disabled = false; }); } else { alert('Вы не согласились с правилами!'); document.getElementById('reg').disabled = false; } } 

  • and you see what comes to you in response, can all transfers be cut there? in general, \n seems to work fine. "View" can be in the browser console tab "Network" / "Network" (or similar) - BOPOH
  • rghost.ru/6yshgtXxS/image.png view-source: world.s56.wh1.su/?engine=reg_post Everything seems to be correct. - W_0rld
  • You can see the jquery characters themselves. I cannot check it myself (the local editor cannot send a request to your site because of Access-Control-Allow-Origin), try to send the dataType , you can specify html , then it’s like tags that will work. - BOPOH
  • as far as I remember, in php \ n you need to write in double quotes so that the hyphenation symbol is perceived. Perhaps this is the problem. - IVsevolod

1 answer 1

I decided not to bathe with the alert, made a simple conclusion in the block.

 function register() { if (document.getElementById("five").checked) { document.getElementById('reg').disabled = true; var nick = document.getElementById("one").value; var pass = document.getElementById("two").value; var secretik = document.getElementById("three").value; var rules = document.getElementById("five").value; $.post("index.php?engine=reg_post", { login: nick, password: pass, secret: secretik, rule: rules }, function(data) { document.getElementById('errorregister').innerHTML = data; document.getElementById('reg').disabled = false; }); } else { alert('Вы не согласились с правилами!'); document.getElementById('reg').disabled = false; } }