https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • l

    lemon-grass-35120

    07/20/2022, 9:43 AM
    I am using Flask btw
  • r

    ripe-action-67367

    07/20/2022, 9:52 AM
    https://htmx.org/headers/hx-trigger/ > If you want to pass details along with the event, you can move to JSON for the value of the trigger: > > HX-Trigger: {"showMessage":"Here Is A Message"}
  • l

    lemon-grass-35120

    07/20/2022, 9:53 AM
    I think I did that
  • l

    lemon-grass-35120

    07/20/2022, 9:53 AM
    I see the response in Chrome
  • l

    lemon-grass-35120

    07/20/2022, 9:54 AM
    output = { "showMessage": "Here Is A Message" } resp = jsonify(output) resp.headers['HX-Trigger-After-Swap'] = 'timer_started' return resp
  • r

    ripe-action-67367

    07/20/2022, 9:54 AM
    the docs suggests putting the json in the header itself
  • r

    ripe-action-67367

    07/20/2022, 9:54 AM
    resp.headers['HX-Trigger-After-Swap'] = output
  • r

    ripe-action-67367

    07/20/2022, 9:54 AM
    like that
  • r

    ripe-action-67367

    07/20/2022, 9:55 AM
    change "showMessage" to the name of your event and you should be good to go
  • l

    lemon-grass-35120

    07/20/2022, 9:55 AM
    ah ok let me check
  • l

    lemon-grass-35120

    07/20/2022, 9:58 AM
    That causes: "SyntaxError: Unexpected token ' in JSON at position 1"
  • r

    ripe-action-67367

    07/20/2022, 9:59 AM
    Can you see the header in response in Chrome?
  • l

    lemon-grass-35120

    07/20/2022, 9:59 AM
    To be clear, I changed my event name to showMessage ๐Ÿ™‚
  • r

    ripe-action-67367

    07/20/2022, 10:00 AM
    oh
  • r

    ripe-action-67367

    07/20/2022, 10:00 AM
    why is it single-quoted?
  • r

    ripe-action-67367

    07/20/2022, 10:00 AM
    JSON only supports ", not '
  • l

    lemon-grass-35120

    07/20/2022, 10:00 AM
    it's the jsonify of flask
  • l

    lemon-grass-35120

    07/20/2022, 10:01 AM
    wait, I'll just send back the json string
  • l

    lemon-grass-35120

    07/20/2022, 10:01 AM
    it work ๐Ÿ˜ฎ
  • l

    lemon-grass-35120

    07/20/2022, 10:02 AM
    thanks a lot ๐Ÿ™‚
  • l

    lemon-grass-35120

    07/20/2022, 10:03 AM
    very strange that flask.jsonify returns the ' though ...
  • l

    lemon-grass-35120

    07/20/2022, 10:03 AM
    that call for some investigation.
  • r

    ripe-action-67367

    07/20/2022, 10:08 AM
    it's actually extremely weird, considering that when JSON was in the response, it used the correct quotes. But I have zero experience with flask, so, little help from me there
  • l

    lemon-grass-35120

    07/20/2022, 10:09 AM
    No problem. You helped me a lot! Thanks!!
  • f

    few-vegetable-15970

    07/20/2022, 10:54 AM
    You are not alone: > Critical thinker. You rarely take things as a given without first getting the facts. When colleagues say โ€œbecause thatโ€™s the way itโ€™ done,โ€ or a vendor promises the solution to all you problems, you smell a challenge. The Pragramatic Programmer. Young people should read old books (it was re-edited in 2020 though).
  • s

    sparse-nail-77743

    07/20/2022, 11:14 AM
    Hey, just stumbled upon htmx via the HN article today and seems to be a cool project. I'm currently using Hotwired with Node.js backend and liking it, however sometimes feeling if it could be a bit simpler. Probably will take htmx for a spin in a new project as I'm already rewriting the SPA stuff into Hotwired and don't wanna restart the process ๐Ÿ˜„ Anyways, thanks for creating this!
  • s

    steep-lamp-42308

    07/20/2022, 1:56 PM
    > The young boys should read old books Why only the boys? Or did you mean young people?
  • f

    few-vegetable-15970

    07/20/2022, 2:12 PM
    yes, sorry! (edited)
  • w

    witty-garage-37227

    07/20/2022, 3:47 PM
    QQ: Is there a way (preferably an event) to catch boosted links. I am having to add
    _=on click send loading to #sys_loader
    to show a global loading overlay, when a boosted link is clicked, is there a way I can do this universally
  • c

    calm-ice-23682

    07/20/2022, 4:32 PM
    maybe have a quick read of https://htmx.org/docs/#indicators
1...755756757...1146Latest