-
Hello, Is it possible to make an ajax-request with Naja, and display the result in a target-element on page? (like hx-target in htmx) |
Beta Was this translation helpful? Give feedback.
Answered by
jiripudil
Jul 10, 2024
Replies: 1 comment 3 replies
-
Hi, I'm afraid that's not possible, at least not in the way htmx does that. Naja is essentially a client to Nette Framework's ajax solution: it is hardwired to accept a JSON response, and replace snippets that are sent from the server – which is Nette's solution for what you're asking. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nette has a whole server-side thing for this, but the gist is that it sends a response like this:
Naja then finds the
#snippet--id
element and replaces (or appends/prepends) its content with what's in the payload.