diff --git a/scripts/execute-function/feedbackForm_DOM.js b/scripts/execute-function/feedbackForm_DOM.js index fc6665a..de3fd2f 100644 --- a/scripts/execute-function/feedbackForm_DOM.js +++ b/scripts/execute-function/feedbackForm_DOM.js @@ -1,18 +1,18 @@ $(function () { - $('#formLinkShortener').submit((event) => { - event.preventDefault(); - const postdata = $('#formLinkShortener').serialize(); + $('#feedbackForm').submit((e) => { + e.preventDefault(); + const postdata = $('#feedbackForm').serialize(); $.ajax({ type: 'POST', - url: '../../php/shortenLink.php', + url: '../../php/feedbackForm.php', data: postdata, - success: (text) => { - try { - $(".results").html(JSON.parse(text).message); - } catch (error) { - $(".results").html("URL invalide."); - } + success: (response) => { + const result = JSON.parse(response); + $(".results").html(result.message); + if(result.isSuccess) { + $("#feedbackForm")[0].reset(); + } } }); - }); + }); }); \ No newline at end of file diff --git a/scripts/execute-function/linkShortener_DOM.js b/scripts/execute-function/linkShortener_DOM.js index 6a5e7f9..ebc42e1 100644 --- a/scripts/execute-function/linkShortener_DOM.js +++ b/scripts/execute-function/linkShortener_DOM.js @@ -14,15 +14,15 @@ $(function () { } } }); - - // Affiche l'input selon le choix de l'utilisateur sur la page linkShortener - $('.hideUserShortcut').hide(); - $("#option").bind("keyup change", () => { - if ($("#option").val() == "userShortcut") { - $('.hideUserShortcut').show(); - } else { - $('.hideUserShortcut').hide(); - } - }); - }); + }); + + // Affiche l'input selon le choix de l'utilisateur sur la page linkShortener + $('.hideUserShortcut').hide(); + $("#option").bind("keyup change", () => { + if ($("#option").val() == "userShortcut") { + $('.hideUserShortcut').show(); + } else { + $('.hideUserShortcut').hide(); + } + }); }); \ No newline at end of file