$(function() { $('.button_acquista').click(function() { //fLoading( 1 ); var strID_Prodotto = $(this).attr('name'); if ( strID_Prodotto != '' ) { var strProdottoTipo = $('#fp_prodotto_tipo').val(); if ( strProdottoTipo != 'shop' ) { strProdottoTipo = 'proposta'; } var strID_Taglia = $('.product-size li.active a').data('taglia'); var strID_Colore = $('#listColor a.active').data('colore'); $.ajax({ type: "POST", async: false, dataType: "json", url: "/tpl/default/assets/ajax/setCarrello.php", data: "action=setCarrello" + "&pstrProdottoTipo=" + strProdottoTipo + "&pstrID_Prodotto=" + strID_Prodotto + "&pintQuantita=" + $("#fp_quantita").val() + "&pstrCarrelloTipo=" + $("#fp_carrello_tipo").val() + "&pstrLangCurrent=" + $("#fp_lang_current").val() + ( strID_Taglia != undefined && strID_Taglia != "" ? "&pstrID_Taglia=" + strID_Taglia : "" ) + ( strID_Colore != undefined && strID_Colore != "" ? "&pstrID_Colore=" + strID_Colore : "" ), success: function(data) { if ( data.status == 'ok' ) { $('#cart-number-items-a .cart-number-items').text( data.totale_prodotti ); $('#cart-number-items-a').removeClass('hide'); swal({ title: "Ok, la réservation est dans le panier !", text: "Continuez à naviguer ou accédez au panier pour terminer la commande", type: "success", showCancelButton: true, cancelButtonText: "Suite", confirmButtonText: "Aller au panier", closeOnConfirm: true }, function(){ location.href = $('#fp_carrello_url').val(); }); } else swal("Oops!","Quelque chose s'est mal passé.","error"); }, error: function(data){swal("Oops!","Quelque chose s'est mal passé.","error");} }); /* ajax */ } }); });