Id like a way to better control when x-ajax does it's request. If there is some easy way to make x-ajax wait for an event before requesting the url or to handle empty string graciously would be nice.
For example:
As it is currently, x-ajax seems to require a url and fetches it immediately.
In some cases, you don't want this to happen, but using an empty string seems to cause errors.
I've tried to putting my x-ajax in a template with x-if, but doing so seems to result in repeat fetches.
For example:
Thought it might work, but each 'open' then gives me a duplicate. I'm sure there is a clever way around this with alpine, though perhaps it's something that could be easily addressed by handling 'empty string' and ignoring.
This way you could do:
x-ajax.query.article.replace="open ? 'myUrl' : ''"
Id like a way to better control when x-ajax does it's request. If there is some easy way to make x-ajax wait for an event before requesting the url or to handle empty string graciously would be nice.
For example: As it is currently, x-ajax seems to require a url and fetches it immediately. In some cases, you don't want this to happen, but using an empty string seems to cause errors.
I've tried to putting my x-ajax in a template with x-if, but doing so seems to result in repeat fetches.
For example:
Thought it might work, but each 'open' then gives me a duplicate. I'm sure there is a clever way around this with alpine, though perhaps it's something that could be easily addressed by handling 'empty string' and ignoring. This way you could do:
x-ajax.query.article.replace="open ? 'myUrl' : ''"