I was wondering what the right way of doing things would be If i want to have a button that onclick returns the contents of a kirby snippet via ajax.
I know I could create a seperate page and template that would just output that snippet, and then just make a ajax call to that page, but I dont want to end up having 100 Pages for seperate ajax calls, since that would just bloat my backend.
<? foreach($site->stoneaccessories()->toStructure() as $stoneAccessorie):?>
<? foreach($stoneAccessorie->slider()->toStructure() as $slider):?>
<span><? echo $slider->text() ?></span>
<span><? echo $slider->subtext() ?></span>
<? endforeach;?>
<? endforeach;?>
Maybe this is the right path API | Kirby CMS but sadly the documentation isnt there yet.