diff options
Diffstat (limited to 'public/js/form.js')
-rw-r--r-- | public/js/form.js | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/public/js/form.js b/public/js/form.js index 6386ea8..1752f55 100644 --- a/public/js/form.js +++ b/public/js/form.js | |||
@@ -1,24 +1,23 @@ | |||
1 | //function sendMessage(){} | 1 | //function sendMessage(){} |
2 | 2 | ||
3 | function changeRecipient(){ | 3 | function changeRecipient(id){ |
4 | const email = document.getElementById('recipient').value; | 4 | const email = document.getElementById('recipient').value; |
5 | const id_form = ''; | 5 | const warning = document.querySelector('.no_recipient_warning'); |
6 | 6 | ||
7 | fetch('index.php?action=recipient_email', { | 7 | fetch('index.php?action=recipient_email', { |
8 | method: 'POST', | 8 | method: 'POST', |
9 | headers: { | 9 | headers: { |
10 | 'Content-Type': 'application/json' | 10 | 'Content-Type': 'application/json' |
11 | }, | 11 | }, |
12 | body: JSON.stringify({ id_form: id_form, email: email }) | 12 | body: JSON.stringify({ id: id, email: email }) |
13 | }) | 13 | }) |
14 | .then(response => response.json()) | 14 | .then(response => response.json()) |
15 | .then(data => { | 15 | .then(data => { |
16 | if(data.success) | 16 | if(data.success){ |
17 | { | 17 | warning.classList.add('hidden'); |
18 | toastNotify('Adresse e-mail de destination modifiée'); | 18 | toastNotify('Adresse e-mail de destination modifiée'); |
19 | } | 19 | } |
20 | else { | 20 | else{ |
21 | |||
22 | console.error('Erreur: echec de la modification de l\'adresse e-mail de destination'); | 21 | console.error('Erreur: echec de la modification de l\'adresse e-mail de destination'); |
23 | } | 22 | } |
24 | }) | 23 | }) |