Skip to content

Commit d4046e9

Browse files
authored
Add html builder postAjax docs.
1 parent 7bec936 commit d4046e9

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

html-builder-post-ajax.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Html Builder Post Ajax
2+
3+
Use post method to submit the dataTables ajax request.
4+
5+
See [datatables.net](https://datatables.net/) official documentation for [`ajax option`](https://datatables.net/reference/option/ajax) for details.
6+
7+
**Syntax**
8+
```php
9+
$builder->postAjax($attributes);
10+
```
11+
12+
## Post Ajax Parameter
13+
Ajax parameter (`$attributes`) can either be a string or an array.
14+
15+
**String Attributes**
16+
17+
When the attribute passed is a `string`. The builder will treat this as the `URL` where we fetch our data.
18+
19+
```php
20+
$builder->postAjax(route('users.data'));
21+
```
22+
23+
> {tip} Setting ajax to `null` or `empty string` will use the current url where DataTables was used.
24+
25+
**Array Attributes**
26+
27+
Attributes are the same with the `ajax()` method request valid parameters.
28+
29+
```php
30+
$builder->postAjax([
31+
'url' => route('users.data'),
32+
])
33+
```
34+
35+

0 commit comments

Comments
 (0)