> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Hosted Fields with Ajax onSubmitCompleteEvent

If you want a purely Ajax interaction, in which the browser does not redirect after form submission, use `onSubmitCompleteEvent` in your options and HOA with Hosted Fields will not redirect. (If you leave `onSubmitCompleteEvent` out of the options, redirect will occur.)

In a purely Ajax interaction, when the customer clicks the **Submit** button in the parent window form an Ajax call submits all of the form fields back to Vindicia. Upon completion, there is typically a redirect to a Success or Error page.

Place code similar to the following in your options and there will be no redirect. Instead, your function `finishCheckout` will be called after the Submit to Vindicia completes.

```

onSubmitCompleteEvent: function(event) {
  finishCheckout(event.detail.url);
  }
```

| event.detail.fieldType | String | Always returns submit at this time. |
| - | - | - |
| event.detail.url | String | Contents is the redirect URL. This reflects the WebSession success or error URL that was previously defined. |
| event.detail.isValid | Boolean | Always returns true at this time. |
| event.detail.dataLength | Number | Always returns zero at this time. |
| **Parent topic:**[Implementing HOA with Hosted Fields](../topics/Implementing_HOA_with_Ho) | | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.