Skip to content

Instantly share code, notes, and snippets.

@bitneek
Created November 2, 2011 21:46
Show Gist options
  • Save bitneek/1335023 to your computer and use it in GitHub Desktop.
Save bitneek/1335023 to your computer and use it in GitHub Desktop.
How to add Unbounce form parameters to a URL
<script>
jQuery(document).ready(function() {
var processingSubmit = false;
var submitButton = jQuery('#'+window.module.lp.form.data.formButtonId);
var submitAction = submitButton.data('events').click[0];
var baseURL = window.module.lp.form.data.confirmData;
submitButton.unbind('click', submitAction);
submitButton.click(function(e) {
if (processingSubmit) {
return;
}
processingSubmit = true;
window.module.lp.form.data.confirmData = baseURL + '?' + jQuery.param(jQuery.map(jQuery('form').serializeArray(),
function(param) {
return (param.name === 'pageId' || param.name === 'pageVariant') ?
null :
param;
}));
submitAction.handler(e);
processingSubmit = false;
});
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment