Skip to content

Inertia Js Vue Laravel Accordion #386

Answered by claudiodekker
dubljanin96 asked this question in Help
Discussion options

You must be logged in to vote

Hi @BlueSilver001,

While Inertia doesn't really support this by itself, you can totally achieve this using Ajax/XHR calls (e.g. using Axios or fetch), which is perfectly suited for situations like this.

Basically what you'll want to do on the back-end, is to create an (api) endpoint that contains information in the URL (like an id) to 'know' what accordion it's loading. Then, you load the data for that specific accordion, and return it as JSON. Next, on the front-end, you'll want to add an on-click event listener on the element that handles the unfolding/folding of the accordion, so that when you click it it can make the Ajax/XHR call to the API endpoint you made. Next, using async/await …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by claudiodekker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants