# Order Button

No ajax calls are sent when clicking the order button.
<br>
Instead, the order button is wrapped in a `<form>` element that physically submits the page.
<br>
The reason for this is that the server might need to redirect the user to a third-party payment gateway.

There is no need to pass additional form data with the request.
<br>
User input from other UI components should already be stored server-side.

## Example

Initialize using JavaScript.
<br>
The `formAttributes` option can contain any [form attributes](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form).

```JavaScript
import { OrderButtonUI } from 'geta-checkout';

render('[data-order-button]', OrderButtonUI, {
    formAttributes: {
        action: 'checkout/order', // Example
        method: 'post' // Example
    }
});
```

As with other UI components, you can also pass options through a `data-attribute`.

```html
<div data-order-button='{"formAttributes": {"action": "checkout/order", "method": "post"}}'></div>
```

<div class="example">
    <div data-order-button='{"formAttributes": {"action": "checkout/order", "method": "post"}}'></div>
</div>

## Writing your own

If the built-in component doesn't fit your needs, you can easily create your own:

```html
<form action="checkout/order" method="post">
    <button>
        Order
    </button>
</form>
```