How to update an Alpine component when loaded by ajax #857
jsantari
started this conversation in
4. General
Replies: 1 comment 7 replies
-
Have you used |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've been pulling my hair out for days on this. I have been trying dynamically load a component that uses an external data function and the html that goes with it using ajax using the htmx.org library. If all the code is in the initial page it works fine. When using the htmx.org library to load the js function code and html dynamically you always get a function not found error from Alpine on my function (named calc) as it apparently can not see it. If I move the js code into the main page and still load the html with htmx then it works but that defeats the purpose of trying to make it into a standalone component package. I've tried to define my function using window.calc = function() {...} but no luck with that either. Is there no way to get this to work?
Beta Was this translation helpful? Give feedback.
All reactions