// JavaScript Document $("#cookie").validator().on("submit", function (event) { // alert(); if (event.isDefaultPrevented()) { // handle the invalid form... formErrorCookie(); submitCookie(false, "Non hai compilato il modulo correttamente"); } else { // everything looks good! event.preventDefault(); submitFormCookie(); } }); function submitFormCookie(){ // Initiate Variables With Form Content var json = $("#cookie").serialize(); $.ajax({ type: "POST", url: "https://www.hotelelsalvador.net/gest-cookie.php", data: json, success : function(text){ if (text == "successCoockie"){ //alert(text); //formSuccessCookie(); $("#second-modal").modal("hide"); return false; } else { formErrorCookie(); submitCookie(false,text); } } }); } // JavaScript Document Tutti $("#cookieTutti").validator().on("submit", function (event) { //alert("A"); if (event.isDefaultPrevented()) { // handle the invalid form... formErrorCookieTutti(); submitCookieTutti(false, "Non hai compilato il modulo correttamente"); } else { //alert("B"); // everything looks good! event.preventDefault(); submitFormCookieTutti(); } }); function submitFormCookieTutti(){ // Initiate Variables With Form Content var json = $("#cookieTutti").serialize(); $.ajax({ type: "POST", url: "https://www.hotelelsalvador.net/gest-cookie.php", data: json, success : function(text){ //alert(); if (text == "successCoockie"){ //alert(); //formSuccessCookie(); $("#modalCookie").modal("hide"); return false; } else { formErrorCookieTutti(); submitCookieTutti(false,text); } } }); } // JavaScript Document Tutti $("#cookieTuttiPulsante").validator().on("submit", function (event) { //alert("A"); if (event.isDefaultPrevented()) { // handle the invalid form... formErrorCookieTutti(); submitFormCookieTuttiPulsante(false, "Non hai compilato il modulo correttamente"); } else { //alert("B"); // everything looks good! event.preventDefault(); submitFormCookieTuttiPulsante(); } }); function submitFormCookieTuttiPulsante(){ // Initiate Variables With Form Content var json = $("#cookieTuttiPulsante").serialize(); $.ajax({ type: "POST", url: "https://www.hotelelsalvador.net/gest-cookie.php", data: json, success : function(text){ //alert(); if (text == "successCoockie"){ //alert(); //formSuccessCookie(); $("#modalCookie").modal("hide"); return false; } else { formErrorCookieTutti(); submitFormCookieTuttiPulsante(false,text); } } }); }