Phoenix Form

PhoenixForm is a HTML form operation helper, include it by:


And you must have a <form id="#admin-form"> ... element in your HTML so Phoenix can operate this form.

Submit and RESTful CRUD

You can simply use this JS code to submit form:

// Submit with default action defined on <form action="...">

// Submit with custom URI and query
Phoenix.submit('/flower/sakuras', {page: 3});

// Send POST
Phoenix.submit('/flower/sakura', data, 'POST');

// Send custom RESTful method, will add `_method` to your params
Phoenix.submit('/flower/sakura', data, 'POST', 'PUT');

In PHP template, it wil look like:

Phoenix.submit('{{ $router->route('sakura') }}', {page: 3});

Use simple methods:

// GET
Phoenix.get('/flower/sakura/25', query);

// POST'/flower/sakura/25', query);

// POST with custom method'/flower/sakura/25', query, 'PUT');

// PUT
Phoenix.put('/flower/sakura/25', query);

Phoenix.patch('/flower/sakura/25', query);

Phoenix.sendDelete('/flower/sakura/25', query);

On click event in HTML element:

<button type="button" onclick=""></button>

If you found a typo or error, please help us improve this document.