Skip to content

Instantly share code, notes, and snippets.

@alexermakov
Last active September 25, 2018 21:32
Show Gist options
  • Save alexermakov/2cc012ef2edf88a5ff15 to your computer and use it in GitHub Desktop.
Save alexermakov/2cc012ef2edf88a5ff15 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$('.js_form_mail').submit(function( event ) {
if ($(this)[0].checkValidity()) {
formx = $(this).serialize();
formxa = $(this).serializeArray();
$.ajax({
type: "POST",
url: themePath+"/obr.php",
data: formx,
success: function(msg) {
write_admin(formxa);
$.fancybox.close();
$.fancybox.open({src : '#modal_success'})
}
});
}
});
function write_admin(fordata){
fordata.push({name: 'action', value: 'order_do'});
$.ajax({
url: '/wp-admin/admin-ajax.php',
data: fordata,
type: 'POST',
success: function(data) {}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment