Skip to content

numasi/htmx-json-attribute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HTMX extension for sending plain JSON data defined at attribute level (w/o HTML form)

Use

Clone repo, grab and link json-attribute.js

<meta name='htmx-config' content='{"selfRequestsOnly":false}'>
<script src='https://unpkg.com/htmx.org@2.0.4'></script>
<script src='json-attribute.js'></script>
<div
  hx-post='https://api.hive.blog'
  hx-trigger='load'
  hx-swap='outerHTML'
  hx-target='div'
  hx-ext='json-attr'
  hx-json='{
    "jsonrpc": "2.0",
    "method": "condenser_api.get_blog_entries",
    "params": ["numasi", 0, 10],
    "id": 1
  }'
></div>

See full example at this repo.

Todo

  • Minify
  • ESM module version
  • Add to unpkg, NPM

About

HTMX extension for sending plain JSON data defined at attribute level (w/o HTML form)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published