$(document).ready(function(){ $("label.radioproduct").click(function(){ $("body").animate({scrollTop:$(".scroolpositionform").offset().top},100);var i=$(this);$(".radioproduct").each(function(){$(i).data("image")!=$(this).data("image")?($(this).children("img.radioproductimage").show(),$(this).children("img.none").hide()):($(this).children("img.radioproductimage").hide(),$(this).children("img.none").show())})}); $("#sehir").on("change",function(){var i=$(this).val();$("#ilce").attr("disabled",!1).html(''),$.getJSON("json/il-ilce.json",function(e){$("#ilce").append(''),$.each(e,function(e,n){var o="";n.il==i&&(o+='",$("#ilce").append(o))})})}); Array.from(document.querySelectorAll(".requires-validation")).forEach(function(t){t.addEventListener("submit",function(a){t.checkValidity()||(a.preventDefault(),a.stopPropagation()),t.classList.add("was-validated")},!1)}); //$(".phone").inputmask({ mask: "0(*99) 999-9999", greedy: false, definitions: { '*': { validator: "[1-9]" } }, "clearIncomplete": true }); //$(".phone").inputmask({ mask: "0*99 999 9999", greedy: false, definitions: { '*': { validator: "[1-9]" } }, "clearIncomplete": true }); document.getElementById('telefon').addEventListener('input', function (e) { this.value = this.value.replace(/[^0-9]/g, ''); }); $(".imgscrool").click(function(event) { /* event.preventDefault(); $('body, html').animate({ scrollTop: $('#siparis').offset().top - 80 }, 0); */ }); $('form').submit(function(event) { event.preventDefault(); if (this.checkValidity() === false) { event.stopPropagation(); $(this).addClass('was-validated'); } else { $(".submitbutton").prop("disabled", true); Swal.fire({html:'
Sipariş Oluşturuluyor...
Lütfen Bekleyiniz
',buttons: false,showCancelButton: false,showConfirmButton: false,allowOutsideClick: false}); var formData = $(this).serialize(); $.ajax({ type: 'POST', url: './gonder.php', data: formData, success: function(response) { $(".submitbutton").prop("disabled", false); if (response.redirectUrl) { window.location.replace(response.redirectUrl); setTimeout(function() { swal.close(); }, 1000); }else{ Swal.fire({icon: 'error',title: 'Hata!',text: 'Sipariş oluşturulamadı bir hata oluştu',confirmButtonText: "Kapat",confirmButtonColor: '#111',}); } }, error: function(jqXHR, textStatus, errorThrown) { $(".submitbutton").prop("disabled", true); Swal.fire({icon: 'error',title: 'Hata!',text: 'Sipariş oluşturulamadı bir hata oluştu',confirmButtonText: "Kapat",confirmButtonColor: '#111',}); } }); } }); swal.close(); });