More resiliently:
form.onSuccess(function(submittedValues,originalThankYouHref){
let originalThankYouURL = new URL(originalThankYouHref);
let overrideThankYouURL = new URL("https://www.example.com");
for(const qp of originalThankYouURL.searchParams.entries()){
overrideThankYouURL.searchParams.append(...qp);
}
location.href = overrideThankYouURL;
return false;
});
(You don't want to lose the aliId if the Thank You URL happens to be a Marketo LP.)
Is that field actually on the form in Form Editor?