I have two scripts for the form. The first ajax script sends an ajax form with data to an e-mail. The second script sends the data from the form to the E-sputnik service. I can connect them one by one. Is it possible to do whatever the form sends to the e-mail and e-satellite? Here are the scripts
Script to send data to e-sputnik
$(document).on("submit", ".popup-form", function (e) { e.preventDefault(); $(this).find('button[type=submit]').attr('disabled',true); var form_data = $(this).serialize(); var btn_submit = $(this).find('[type=submit]'); var data = { 'action': 'userSubscribe', 'form_data': form_data, }; $.ajax({ url: ajaxurl, dataType: 'json', type: 'POST', data: data, beforeSend: function () { $(this).find('button[type=submit]').attr('disabled',true); }, success: function (data) { $(this).find('button[type=submit]').removeAttr('disabled'); $.magnificPopup.close(); window.open(thxDomain,"_self") }, error: function (data) { $(this).find('button[type=submit]').removeAttr('disabled'); console.log('Dispatch error. Have fun :)'); } }); return false; }); Script to send data to e-mail
$(".popup-form").submit(function() { //Change var th = $(this); $.ajax({ type: "POST", url: pathPhp, //Change data: th.serialize() }).done(function() { $.magnificPopup.close(); window.open(thxDomain,"_self") setTimeout(function() { // Done Functions th.trigger("reset"); }, 1000); }); return false; });