There is a script to send data from the form to the mailbox via ajax. The script itself works, the data reaches the mail, but there are no notifications about the successful sending of data.
Tell me, please, how to change the code so that after sending the data, the user is informed that the data has been sent?
<script> $(document).ready(function(){ $("#form").submit(function() { var form_data = $(this).serialize(); $.ajax({ type: "POST", url: "send.php", data: form_data, success: function(response) { alert("Данные отправлены"); document.getElementById(form-result).innerHTML = "Запрос отправлен"; }, error: function(response) { document.getElementById(form-result).innerHTML = "Ошибка при отправке формы"; } }) }) }) </script>
document.getElementById(form-result)should bedocument.getElementById("form-result")- andreymalformexactly? - Mr. Black