Good day. Faced a problem. On the page there is a form:
<form id="recoverform" class="loginform" action=""> <input type="email" name="email" placeholder="Email"> <button class="btn" onclick="sandEmail();" name="sandBtn">Отправить</button> <p>Сообщение с данными для входа будет отправлено на ваш Email</p> </form> It is sent via ajax request:
function sandEmail(){ $.ajax({ url:'sendMessage.php', type:'post', data: $('#recoverform').serialize(), success: function(result){ $(sendForm).next().html(result); } }); } Pressing the button will do the following. A page opens with the same url: http://hostname.ru/login?email=&sandBtn=
What's wrong? Why is the data transmitted not by the POST method, but by GET and why on the current page, and not on the php file without updating the current page?
sandBtngoes without avaluefield, entering a mail box in question ... If you just press a button, then the behavior is quite correct ... - DNS