// Bind the form submission event only once
jQuery(document).ready(function() {
jQuery('#frmSubmit').on('submit', function(e) {
e.preventDefault(); // Prevent the default form submission
jQuery('#acsubmit').html('Please wait...');
jQuery('#acsubmit').attr('disabled', true); // Disable the button to prevent multiple clicks
jQuery.ajax({
url: 'https://script.google.com/macros/s/AKfycbz0Ejw8TaO8eNreTuUh_ELmi1y4F7YhrFbXTg1CXiOsxkRVSVceStN4e9--NSl8UJMD/exec',
type: 'post',
data: jQuery('#frmSubmit').serialize(),
success: function(result) {
resend(); // Call the resend function after the first AJAX call succeeds
}
});
});
});
function submitApplycomForm() {
// Update the button icon and text
$("#acsubmit i").removeClass('fa fa-paper-plane').addClass('fas fa-spinner fa-pulse');
$("#applycom").submit(); // Trigger form submission
}
function resend() {
var formData = new FormData(jQuery('#frmSubmit')[0]); // Create FormData object with form data
jQuery.ajax({
url: 'submission',
type: 'post',
data: formData, // Send FormData instead of serialized form data
processData: false, // Don't process the data
contentType: false, // Don't set contentType
success: function(result) {
alert(result); // Alert the result
jQuery('#frmSubmit')[0].reset(); // Reset the form
jQuery('#acsubmit').attr('disabled', false); // Re-enable the submit button
window.location.href = 'https://www.ardaconference.com/journals/google-scholar/'; // Redirect
}
});
}