# Using Marketo forms

## Customizing thank you page

The normal Marketo form javascript looks something like this:

```markup
<script>
MktoForms2.loadForm("//app-ab00.marketo.com", "488-XXX-XXXX", 1234);
</script>
```

If you would like to customize the form to route the lead to a custom thank you page, you can modify this javascript. *Note: make sure that you maintain the three existing values from your Marketo form.*

```markup
<script>
MktoForms2.loadForm("//app-ab00.marketo.com", "488-XXX-XXXX", 1234, function(form) {
  form.onSuccess(function(values, followUpUrl) {
    // Take the lead to a different page on successful submit
    location.href = "/your-thank-you-page-url/";
    // Return false to prevent the submission handler continuing with its own processing
    return false;
  });
});
</script>
```

In the above code, you can customize the /your-thank-you-page-url/ and change that to your thank you page.

### Using base\_directory

If the form within your template will be used on multiple sites under different base\_directory paths, you can use our macro to dynamically generate the correct thank you page URL.

```javascript
location.href = "${base_directory}your-thank-you-page-url/";
```
