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