Skip to content

Instantly share code, notes, and snippets.

@Ginnw2 Ginnw2/ajax form
Created Feb 19, 2020

Embed
What would you like to do?
AJAX форма с ответом в fancybox
$('#FORMFEED1').on("submit", function(event) {
var form = $(this);
var form_data = new FormData(this);
event.preventDefault();
$.ajax({
type: "POST",
async: true,
url: "/ajax/form.php",
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
You can’t perform that action at this time.