Here is my attempt
$('#email-form').submit(function (event) {
window.location.href = url;
});
It works in some browser, but not in safari. Apparently, this breaks this original form submission code.
My second attempt, this works
$('#email-form').submit(function (event) {
setTimeout(function(){
window.location.href = url;
}, 500);
});
By giving it some time, the submission code fires first, then my code runs and successfully redirects.
What is a more robust way of writing this code (not reliant on some random timer wait)?
I think the best way to work this in every browser is ๐
setTimeout(function(){document.location.href = "your link";},250);