У меня проблема с перенаправлением страницы после того, как пользователь нажал на кнопку ОК в сладком оповещении. я не понимаю, где я должен вставить код и какой код. Я хотел бы, чтобы, когда пользователь нажимал ОК, после успешного завершения в форме, перенаправлялся на ... пример "google.com".
Я пытался использовать решения на сайте, но они не работали или я ошибся, вставив их Спасибо всем за помощь
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9"></script>
<script>
$(function() {
$(document).ajaxStop($.unblockUI);
$('form').on('submit', function(e) {
e.preventDefault();
var response = grecaptcha.getResponse();
if(response.length == 0) {
//reCaptcha not verified
alert("Verifica di non essere un robot!");
return false;
} else {
//reCaptch verified
$.blockUI({
message: '<p><img src="img/Eclipse-1s-134px.svg" alt="">Ci siamo...non uscire</p>'
});
var formData = new FormData(this);
$.ajax({
type: 'post',
url: 'mailer.php',
data: formData,
cache: false,
dataType: 'json',
contentType: false,
processData: false,
mimeType: "multipart/form-data",
xhr: function () {
//upload Progress
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) {
xhr.upload.addEventListener('progress', function (event) {
var percent = 0;
var position = event.loaded || event.position;
var total = event.total;
if (event.lengthComputable) {
percent = Math.ceil(position / total * 100);
}
//update progressbar
$('.progress-bar').animate({
width: percent + '%'
}, {
duration: 100
});
}, true);
}
return xhr;
},
success: function (response) {
if (response.success) {
Swal.fire(
'Perfetto!',
'Il tuo locale è registrato!',
'success'
);
$('form').trigger("reset");
$('.progress-bar').animate({
width: '10%'
}, {
duration: 1000
});
} else {
alert(response.message);
}
},
error: function (response) {
Swal.fire({
icon: 'error',
title: 'Oops...',
text: 'Qualcosa è andato storto!',
footer: '<a href>Riprovaci!</a>'
});
}
});
}
});
});
</script>