---
title: Ajax Forms
---

# Ajax Forms

<div class="documentation__toc"></div>

## Introduction

You can easily make forms use ajax behavior by setting the `ajax` property.

```php
protected $ajax = true;
```

You can also flag forms as ajax on the fly.

```php
$builder->setAjax(true);
```

## Custom Data

You can easily add custom data to the JSON response by adding `public function onJsonResponse(Collection $data){}` to your form builder. This will allow you to modify the array before it being set in the form response.


Ajax forms are designed to be included in a modal by default but you can configure it to display using options or however you like.

> **In Development:** The Ajax API is still being developed. While ajax forms are usable, more robust JSON response information is still missing.{.note}
