Closed ericxin1982 closed 8 months ago
And the indicator chapter, how you add the aira-busy class to target table, that is not clear enough. Would you please share?
Hi!
Do you think you would have x-ref available to replace x-target
That’s not likely to happen because we need a unique identifier on the page so that we know what content to merge inside an incoming request. x-ref
is only unique per component, but id
is required to be unique per page.
how you add the aira-busy class to target table
aria-busy
is automatically added to a target when it is updating. You only need to write the CSS to make an indicator show when aria-busy
is present.
That means aria-busy this css just prepared there, then indicator would take it if indicator tag is used, that is what you meant?
Then x-target can accept dynamic id? I mean the target id can be generated after it is being loaded into webpage.
That means aria-busy this css just prepared there, then indicator would take it if indicator tag is used, that is what you meant?
Yes, I think that's about right. There's not an indicator "tag" but you create the indicator by checking if aria-busy
is present on a target using a CSS selector. I made a some quick demos that might help explain it better: https://codepen.io/imacrayon/pen/JjzGeMa
Then x-target can accept dynamic id? I mean the target id can be generated after it is being loaded into webpage. hi @imacrayon,
I have this concern, thanks. Please help me verify it.
Yes the ID in x-target
can be dynamic you can include more than one ID too.
That is great, thanks for your help.
I saw all the examples, the whole alpine-ajax must be used within a form element? That is a must?
Can you give me more $ajax example, I try to understand it better, and think about how to use it properly.
Sorry, @imacrayon
I have one more question, how to add request header through $ajax to server, not the X-Alpine-Request I am talking about.
Thanks Eric Xin
No way to customize headers yet. That will probably be coming soon though.
Ok, then how about $ajax, we can use it in any element right?
Yeah, just like any other Alpine magic, you can use it within any event handler on any element.
That is excellent, good news to know.
Hi @imacrayon
Do you think you would have x-ref available to replace x-target in next version, since I may not have id for target element, but I would have x-ref for target element.
Thanks Eric Xin