mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-30 06:21:19 +00:00
Fix example for responseHandling config via <meta> tag (#2715)
The current example throws this error: htmx.js:2914 SyntaxError: Expected property name or '}' in JSON at position 1 (line 1 column 2) at JSON.parse (<anonymous>) at parseJSON (htmx.js:816:19) at getMetaConfig (htmx.js:4902:14) at mergeMetaConfig (htmx.js:4909:24) at HTMLDocument.<anonymous> (htmx.js:4917:5) Co-authored-by: ekzyis <ekzyis@ekzy.is>
This commit is contained in:
parent
13b44b7897
commit
e2b671d2f5
@ -972,10 +972,17 @@ Using the [meta config](#configuration-options) mechanism for configuring respon
|
|||||||
config:
|
config:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<meta name="htmx-config" content='{code:"204", swap: false}, // 204 - No Content by default does nothing, but is not an error
|
<meta
|
||||||
{code:"[23]..", swap: true}, // 200 & 300 responses are non-errors and are swapped
|
name="htmx-config"
|
||||||
{code:"422", swap: true}, // 422 responses are swapped
|
content='{
|
||||||
{code:"[45]..", swap: false, error:true}, // 400 & 500 responses are not swapped and are errors'>
|
"responseHandling":[
|
||||||
|
{"code":"204", "swap": false},
|
||||||
|
{"code":"[23]..", "swap": true},
|
||||||
|
{"code":"422", "swap": true},
|
||||||
|
{"code":"[45]..", "swap": false, "error":true}
|
||||||
|
]
|
||||||
|
}'
|
||||||
|
/>
|
||||||
```
|
```
|
||||||
|
|
||||||
If you wanted to swap everything, regardless of HTTP response code, you could use this configuration:
|
If you wanted to swap everything, regardless of HTTP response code, you could use this configuration:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user