Q:

Redirect to URL with query string

I've built a cloudpage with the Content Builder and need to redirect the user to a URL on submission of a smart capture form, this is all working fine, but I need to pass the email address captured in the form through to the exit page as part of the query string.
I have tried doing this via JavaScript and modifying the URL in the SC init code, but this doesn't seem to work, as it results in a undefined URL. 
I'm wondering if there is a way to do this purely in Salesforce without messing with the generated smart capture code.
var email;
function getEmail() {
    var email = document.getElementById('EmailAddress').value;
}
var url = "https://pub.s7.exacttarget.com/xxxxxxx?emailaddress=".email;

window.ScForm.init({"gearID":"l2l88a3ru0a","smartCaptureFormID":0,"sourceKey":"EEE4BBB7-11B0-453B-90F1-827653B5C7D1","source":"dataExtension","triggeredSend":"","confirmationMessage":"Thank you for your submission.","buttonText":"Submit","formStyling":{"background-color":"#f3f3f3","width":"80%","padding-top":"20px","padding-right":"20px","padding-bottom":"50px","padding-left":"20px","margin-top":"0","margin-right":"auto","margin-bottom":"0","margin-left":"auto","border-color":"transparent","border-width":"0px","border-style":"solid","border-top":false,"border-right":false,"border-bottom":false,"border-left":false},"fieldStyling":{"width":"100%","-moz-box-shadow":"inset 1px 1px 4px #CCCCCC","-webkit-box-shadow":"inset 1px 1px 4px #CCCCCC","box-shadow":"inset 1px 1px 4px #CCCCCC","border":"1px solid #CCCCCC","color":"#222222","display":"inline-block","font-size":"12px","line-height":"1.3","margin-bottom":"9px","padding":"7px","height":"35px !important"},"buttonStyling":{"background-color":"#009DDC","border-color":"#009DDC","border-radius":"3px","border-style":"solid","-webkit-border-radius":"3px","-moz-border-radius":"3px","color":"#FFFFFF","font-family":"Arial, Helvetica, sans-serif","font-size":"16px","line-height":"normal","padding":"10px"},"onSubmitShouldGotoUrl":true,"onSubmitGotoUrlType":2,"onSubmitGotoUrl": url});
 };

The form onsubmit has been changed to 
onsubmit="getEmail()"

A:

You can do something like this
function getEmail() {
    var email = document.getElementById('EmailAddress'); //fetch the email address
}
var url = "https://pub.s7.exacttarget.com/xxxxxxx?emailaddress=";
window.location.href = url.concat(email); // will redirect to the url

window.ScForm.init({"gearID":"l2l88a3ru0a","smartCaptureFormID":0,"sourceKey":"EEE4BBB7-11B0-453B-90F1-827653B5C7D1","source":"dataExtension","triggeredSend":"","confirmationMessage":"Thank you for your submission.","buttonText":"Submit","formStyling":{"background-color":"#f3f3f3","width":"80%","padding-top":"20px","padding-right":"20px","padding-bottom":"50px","padding-left":"20px","margin-top":"0","margin-right":"auto","margin-bottom":"0","margin-left":"auto","border-color":"transparent","border-width":"0px","border-style":"solid","border-top":false,"border-right":false,"border-bottom":false,"border-left":false},"fieldStyling":{"width":"100%","-moz-box-shadow":"inset 1px 1px 4px #CCCCCC","-webkit-box-shadow":"inset 1px 1px 4px #CCCCCC","box-shadow":"inset 1px 1px 4px #CCCCCC","border":"1px solid #CCCCCC","color":"#222222","display":"inline-block","font-size":"12px","line-height":"1.3","margin-bottom":"9px","padding":"7px","height":"35px !important"},"buttonStyling":{"background-color":"#009DDC","border-color":"#009DDC","border-radius":"3px","border-style":"solid","-webkit-border-radius":"3px","-moz-border-radius":"3px","color":"#FFFFFF","font-family":"Arial, Helvetica, sans-serif","font-size":"16px","line-height":"normal","padding":"10px"},"onSubmitShouldGotoUrl":true,"onSubmitGotoUrlType":2,"onSubmitGotoUrl": url});
 };

call the function in the form onsubmit event

