Load a project in a div onClick


#1

Hello everybody,

Is there a AJAX Kirby trick to load a subpage into a div of the parent ?
My idea is to click on a list of projects and the project selected would load into a specific div. It’s pretty basic, I know how to do it on a static website but I’m afraid I’m not sure for Kirby.

How could I say on click, load $homearticle.url( ) in #project-show div ?

<?php if($homearticle->parent()->uid() == 'projects'): ?>

<article class="article_project">
	<a href='<?php echo $homearticle->url() ?>'>

Thanks !
Valentin


#2

If you know how to do it on a static site, you can do it in Kirby, there’s no difference (if we leave aside the PHP bit in Kirby). Just get the URL from the href attribute (or pass it as a data attribute) in your JavaScript click event.