Last active
June 1, 2024 00:47
-
-
Save Sentinel-7/1a93cf7739d5e14456499a2417bee770 to your computer and use it in GitHub Desktop.
AjaxForm закрытие окна после отправки + fancybox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
$(document).ready(function() { | |
AjaxForm.Message.success = function() {}; | |
}); | |
$(document).on('af_complete', function(event,res) { | |
if(res.success) $('.fancybox-close-small').click(); | |
if (res.success) { | |
// показываем сообщение об успехе | |
$.fancybox.close(); | |
$.fancybox.open($('#thanks'), { | |
autoSize: true, | |
padding: 0, | |
closeBtn: false, | |
helpers: { | |
overlay: {locked: false, closeClick: true} | |
} | |
}); | |
} else { | |
// закрывать ничего не надо, ибо ошибка и юзер должен её исправлять | |
} | |
}); | |
$(document).on('af_complete', function(event, response) { | |
if (response.success) { | |
$('#callBackModal').modal('hide'); | |
Swal.fire("Спасибо за обращение.", "Мы свяжемся с вами в ближайшее время.", "success"); | |
} | |
response.message=''; | |
} ); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment