I answered my own question. Its the Munchkin code.
I just need to figure out the redirect.
Here is the code
<script src="//app-ab02.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_2190" style="display:none"></form>
<script>
MktoForms2.loadForm("//app-ab02.marketo.com", 663-HBN-994", 2190, function(form) {
MktoForms2.whenReady(function (form) {
form.submit();
});
});
</script>
You already had the redirection code (in the onSuccess). You seem to be cutting and pasting from different sources.
The full code to auto-submit and redirect is:
<script src="//app-sj01.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_1057"></form>
<script>
MktoForms2.loadForm("//app-sjst.marketo.com", "785-UHP-775", 1057, function(form) {
//Add an onSuccess handler
form.onSuccess(function(values, followUpUrl) {
// Take the lead to a different page on successful submit, ignoring the form's configured followUpUrl
location.href = "surveymonkey.com/r/5KQ3VGB";
// Return false to prevent the submission handler continuing with its own processing
return false;
});
form.submit();
});
</script>
You will need the Munchkin JS and Muchkin.init() as well. But, as I've noted, your resulting code will have a race condition. It will not satisfy your requirements reliably. I would not use it on a production site.