<form action="mail-call.php" method="post"> <p>Заказать звонок</p> <input type="text" placeholder="Ваше имя" name="name" required> <input type="text" placeholder="Ваш телефон" name="tel_number" required> <button name="reserve_submit">Заказать звонок</button> </form> This is a form code with a button. After clicking and successful field validation, an email is sent using phpmailer .
I want to change the text on the button with the successful sending of the letter. For onlick text will change even if the fields are filled incorrectly.
What event (or something else) can be attached to correctly implement it?
I thought what can be done via button.onsubmit = function() {this.innerHTML = 'Отправлено'} , but apparently this event is for other purposes ...
JS) and what the server can respond with on success and an error. - user207618<?php if(isset( $_POST['reserve_submit'] )) {... the message body is formed ... and ending with '$ mail-> Send ();' - lexxlAJAXare something from the era of Australopithecus (not always, but in general ...). - user207618