Hey all, another day another 3.0 question
I am currently fighting with the routing on Kirby 3.0.
I want my ajax call loaded content, also work with an url input. But I only get a blank page and my html is empty. My Routing looks like this:
return [
'routes' => [
[
'pattern' => 'about',
'action' => function () {
$kirby = new Kirby();
$page = page('about');
if($page) {
$html = $kirby->render($page);
return new Response($html);
} else {
$page = site()->errorPage();
site()->visit($page);
}
},
'method' => 'POST'
]
[
'pattern' => 'about',
'action' => function() {
$page = page('about');
if($page) {
$data = array('modal' => $page->url());
return array('home', $data);
} else {
$page = site()->errorPage();
return site()->visit($page);
}
}
]
]
];
Not sure if my routing array is wrong. But without the routing the ajax call works like expected.