Redirection after form submission is terminating my ajax call
SOLVE
I am sending an ajax request to my server after form submission ,I set the call of the ajax request in the call back function of onFormSubmit.The form i am working on has a external redirection link once submitted , the problem is I am seeing my ajax request aborted , I am suspecting that it's due to the fast redirection so my question is there is a way to delay it ?
I can always work with redirecting manually but i prefer not to for maintenance purposes (none dev can change easily the redirection links)
Redirection after form submission is terminating my ajax call
SOLVE
Hello thank you for the quick response here is a code sample of a javascript file that i am injecting in the header of the page and I am setting an external link redirection once the form submitted
/** function doSaveLeadInCookiesAndRequestItToIntercom() { var url ="my_url"
window.addEventListener('message', function(event) { if(event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormSubmit') { getCustomerCaseFormData(); //getting the form data using jquery doSaveLeadInCookiesAndRequestItToIntercom();// this will send an ajax call } });
the problem is my ajax call is terminated and I am suspecting the redirection is responsable for that , so is there a way to make the redirection waits the completion of my ajax call . Ps : I am using this redirection.