Skip to content

Instantly share code, notes, and snippets.

@Ginnw2
Last active October 16, 2020 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ginnw2/6f6dcad68140f61513fe5447a3778c4b to your computer and use it in GitHub Desktop.
Save Ginnw2/6f6dcad68140f61513fe5447a3778c4b to your computer and use it in GitHub Desktop.
AJAX форма с ответом в fancybox
$('#FORMFEED').on("submit", function(event) {
var form = $(this);
var form_data = new FormData(this);
event.preventDefault();
$.ajax({
type: "POST",
async: true,
url: $(this).attr('action'),
cache: false,
contentType: false,
processData: false,
data: form_data,
success: (function(result) {
console.log(result);
$("#modal-thanks").html(result);
$.fancybox.close();
$.fancybox.open({src : '#modal-thanks'});
setTimeout(function() {$.fancybox.close();},4500);
form[0].reset();
})
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment