File: hx-encoding.md

package info (click to toggle)
htmx 2.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 96,944 kB
  • sloc: javascript: 65,214; ruby: 44; sh: 39; makefile: 7
file content (18 lines) | stat: -rw-r--r-- 682 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
+++
title = "hx-encoding"
description = """\
  The hx-encoding attribute in htmx allows you to switch the request encoding from the usual \
  `application/x-www-form-urlencoded` encoding to `multipart/form-data`, usually to support file uploads in an AJAX \
  request."""
+++

The `hx-encoding` attribute allows you to switch the request encoding from the usual `application/x-www-form-urlencoded`
encoding to `multipart/form-data`, usually to support file uploads in an ajax request.

The value of this attribute should be `multipart/form-data`.

The `hx-encoding` tag may be placed on parent elements.

## Notes

* `hx-encoding` is inherited and can be placed on a parent element