File "form-scripts-20250608161345.js"
Full Path: /home/asmplong/www/js/form-scripts-20250608161345.js
File size: 4.19 KB
MIME-type: text/plain
Charset: utf-8
$(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("<p>Connexion en cours, veuillez patientez...</p>");
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("<p>Erreur lors de la connexion...</p>");
}
}
});
});
});
$(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();
});
}