Thank You URL to use as a javascript variable
Has anyone had success in using the thank you page URL of a Marketo form as a javascript variable?
I want to be able to reference the thank you page based off of the form that lives on the landing page, but I'm struggling to figure out how that would work.
For example, the browser URL could be pulled with window.location.href; is there a thank you page equivalent?
Looking for something similar to Sanford's thank you page redirect, but instead of a redirect, I just want to pull the link as a variable:
MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals, tyURL) {
var tyLoc = document.createElement("a");
tyLoc.href = tyURL;
tyLoc.search += "&fromURL=" + encodeURIComponent(document.location.href);
document.location = tyLoc;
return false;
});
});