From 64fb52031631bbe0bedb55734c2e10f27d438c2f Mon Sep 17 00:00:00 2001 From: User A1005044 Date: Wed, 17 Jul 2024 06:59:36 +0300 Subject: [PATCH] =?UTF-8?q?GP=20|=20fix:=20=D0=BF=D0=BE=D1=87=D0=B8=D0=BD?= =?UTF-8?q?=D0=B8=D0=BB=20=D1=84=D0=BE=D1=80=D0=BC=D1=83=20+=20=D1=81?= =?UTF-8?q?=D0=BA=D1=80=D1=8B=D1=82=D0=BE=D0=B5=20=D1=85=D1=80=D0=B0=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D1=80=D0=B8=D0=B4=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .secrets.php | 3 +++ assets/js/modals.js | 27 +++++++++------------------ send.php | 10 ++++++---- 3 files changed, 18 insertions(+), 22 deletions(-) create mode 100644 .secrets.php diff --git a/.secrets.php b/.secrets.php new file mode 100644 index 0000000..29a08ce --- /dev/null +++ b/.secrets.php @@ -0,0 +1,3 @@ + { form.addEventListener('submit', (event) => { event.preventDefault(); - const formData = new FormData(event.currentTarget); - const name = formData.get('name'); - const phone = formData.get('phone'); + const formData = new FormData(event.currentTarget); // автоматически формирует объект с полями и значениями + formData.append('act', 'order'); // добавляем поле для проверки на бекенде + + // const name = formData.get('name'); + // const phone = formData.get('phone'); // const message = `Имя: ${name} Телефон ${phone}`; - // sendMessage(message); + event.currentTarget.reset(); fetch('../../send.php', { method: 'POST', - data: { name, phone }, + cache: 'no-cache', + body: formData, }); if (callbackModal) callbackModal.classList.remove('active'); if (thanksModal) thanksModal.classList.add('active'); }); -}); - -// function sendMessage(message) { -// const url = `https://api.telegram.org/bot${BOT_TOKEN}/sendMessage?chat_id=${CHAT_ID}&parse_mode=html&text=${message}`; - -// fetch(url) -// .then((data) => { -// console.log('Message sent successfully:', data); -// }) -// .catch((error) => { -// console.error('Error sending message:', error); -// }); -// } +}); \ No newline at end of file diff --git a/send.php b/send.php index 358640c..5cff261 100644 --- a/send.php +++ b/send.php @@ -1,7 +1,9 @@