芝麻web文件管理V1.00
编辑当前文件:/home/asmplong/www/form-scripts.js.tar
home/asmplong/www/js/form-scripts.js 0000666 00000010307 15017060661 0013551 0 ustar 00 $(document).ready(function(){ $("#formLogin").submit(function(event){ event.preventDefault(); $.ajax({ type: "POST", url: "php/connexion.php", data: $("#formLogin").serialize(), success : function(data){ if(data == 'Success'){ // Le membre est connecté. Ajoutons lui un message dans la page HTML. var msgClasses = "msgSubmit msg_form alert alert-success my-3"; $(".msgSubmit").removeClass().addClass(msgClasses); $(".msgSubmit").html("
Connexion en cours, veuillez patientez...
"); setTimeout(function() { window.location.href="index.html"; }, 1000); } else{ // Le membre n'a pas été connecté. (data vaut ici "failed") var msgClasses = "msgSubmit msg_form alert alert-danger my-3"; $(".msgSubmit").removeClass().addClass(msgClasses); $(".msgSubmit").html("
Erreur lors de la connexion...
"); } } }); }); }); $(document).ready(function(){ $("#formAvis").submit(function(event){ event.preventDefault(); $.ajax({ type: "POST", url: "php/addAvis.php", data: $("#formAvis").serialize(), success : function(text){ if (text == "success"){ formavisSuccess(); } else { formavisError(); submitMSG("#formAvis",false,text); } } }); }); }); $(document).ready(function(){ $("#formcallBack").submit(function(event){ event.preventDefault(); $.ajax({ type: "POST", url: "php/callback.php", data: $("#formcallBack").serialize(), success : function(text){ if (text == "success"){ formcallbackSuccess(); } else { formcallbackError(); submitMSG("#formcallBack",false,text); } } }); }); }); $(document).ready(function(){ $("#formfreeQuotation").submit(function(event){ event.preventDefault(); $.ajax({ type: "POST", url: "php/freequotation.php", data: $("#formfreeQuotation").serialize(), success : function(text){ if (text == "success"){ formfreequotationSuccess(); } else { formfreequotationError(); submitMSG("#formfreeQuotation",false,text); } } }); }); }); function formcallbackSuccess(){ $("#formcallBack")[0].reset(); submitMSG("#formcallBack",true, "Merci, nous vous recontacterons rapidement afin de vous proposer une implantation sur mesure et un devis pour votre projet...") } function formcallbackError(){ $("#formcallBack").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(this).removeClass(); }); } function formfreequotationSuccess(){ $("#formfreeQuotation")[0].reset(); submitMSG("#formfreeQuotation",true, "Merci, nous vous recontacterons rapidement afin de vous proposer une implantation sur mesure et un devis pour votre projet...") } function formfreequotationError(){ $("#formfreeQuotation").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(this).removeClass(); }); } function submitMSG(contener,valid, msg){ if(valid){ var msgClasses = "msgSubmit msg_form alert alert-success my-3"; } else { var msgClasses = "msgSubmit msg_form alert alert-danger my-3"; } $(contener + " .msgSubmit").removeClass().addClass(msgClasses); $(contener + " .msgSubmit").text(msg); } function formavisSuccess(){ $("#formAvis")[0].reset(); submitMSG("#formAvis",true, "Merci, votre avis nous a bien été transmis.") } function formavisError(){ $("#formAvis").removeClass().addClass('shake animated').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function(){ $(this).removeClass(); }); }