Currently I have a form that I am using to post to a pardot form handler. When you successfully post to a form handler in pardot it responds by sending you a 302 redirect. I don't want to redirect to another page. I want to stay on the current page and use the response to show a success or error message. I have tried a multitude of things using javascript:
$('form').on('submit', function(event) {
event.preventDefault();
});
This just doesn't submit the form at all.
$('form').on('submit', function(event) {
return false;
});
This doesn't submit the form as well.
I also cannot use AJAX as Pardot returns a cors error when you try to use AJAX to post to this. Anyone have any idea on how to handle this?
Ideally I would love to use the 302 redirect to construct my response on the page.