jQuery( document ).ready(function() { //form submits via malsup //register var registerForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/register.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#registerForm').ajaxForm(registerForm); var registerFreeForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/register-free.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#registerFreeForm').ajaxForm(registerFreeForm); //update user var registerUpdateForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/updateUser.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#registerUpdateForm').ajaxForm(registerUpdateForm); //update user var changePasswordForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/updatePassword.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#changePasswordForm').ajaxForm(changePasswordForm); //contact form var contactForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/contact.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#contactForm').ajaxForm(contactForm); //contact Artist Form var contactArtist = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/contactArtist.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#contactArtist').ajaxForm(contactArtist); //Forgot Password var forgotPassword = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/forgotPassword.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#forgotPassword').ajaxForm(forgotPassword); //Recover Password var recoverPassword = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/recoverPassword.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#recoverPassword').ajaxForm(recoverPassword); //coupon form var couponForm = { target: '#response2', beforeSubmit: showRequest2, url: 'https://mejoratumezcla.com/functions/coupon.php', success: function() { $('.loaders2').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#coupon-form').ajaxForm(couponForm); //membership coupon form var membershipcouponForm = { target: '#response2', beforeSubmit: showRequest2, url: 'https://mejoratumezcla.com/functions/coupon_membership.php', success: function() { $('.loaders2').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#membership-form').ajaxForm(membershipcouponForm); //updateCreditCard var updateCard = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/updateCard.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#updateCard').ajaxForm(updateCard); //LOGIN ARCHIVE var loginArchiveForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/activateArchiveLogin.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#loginArchiveForm').ajaxForm(loginArchiveForm); //Activate Archive var activateArchiveForm = { target: '#response', beforeSubmit: showRequest, url: 'https://mejoratumezcla.com/functions/activateArchive.php', success: function() { $('.loaders').hide(); $("html, body").animate({ scrollTop: 0 }, "slow"); } }; // pass options to ajaxForm jQuery('#activateArchiveForm').ajaxForm(activateArchiveForm); // presubmit for all requests function showRequest(formData, jqForm, options) { $('.loaders').show(); return true; } // presubmit for all requests function showRequest2(formData, jqForm, options) { $('.loaders2').show(); return true; } });