Send the data collected by a form to the redirected URL

Boris Hocdé Updated by Boris Hocdé

With our JS callbacks, we can set the collected form's data as GET or POST parameters to a redirected URL.

Create a form

First, let's have a form ready. For this example, we'll collect the email and city of the user.

The submit button action doesn't really matter. You can choose "Close the popup". We'll do the redirection somewhere else.

Customize the behavior after the form submit

Create a new JS callback listening for the event After form submit, with the following snippet:

event.preventDefault();
event.target.method = 'GET';
event.target.action = 'https://example.com/';
event.target.submit();

Replace https://example.com/ with the URL where the visitors should be redirected. You can change the method to POST if it's better suited.

And voilà!

After visitors fills the form, they're redirected to https://example.com/?email=test%40test.com&city=new_york.

The built-in fields have predefined IDs (email, phone-number, first_name and last_name). For the other fields, the ID you set will be used as the field name.

Don't hesitate to contact our support if you have any questions.

How did we do?

Close a Popup With JS Code

Contact